Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Tuesday, June 11, 2019

Add *.dll to the GAC - Global assembly cache for Windows Server 2012 or later - Using Powershell

Hi,

Installing the assemble in to global cache

What is GAC
           The Global Assembly Cache is a machine-wide store used to hold assemblies that are intended to be shared by several applications on the machine. Each computer where the common language runtime (CLR) is installed has a global assembly cache.

How to load/ Add *.dll
I needs load my custom *.dll files developed in dotnet to be used in AX or application wide.

This can be achieved in multiple ways like.

1. Power-shell commands.
2. CMD prompt.
3. Developer CMD Prompt for Visual Studio.
and few more

This post is using power-shell.

1. Run windows powershell as administrator
2. Execute the below code with setting your path in first line
3. Mention your dll name in highlighted text with the extension as .dll
4. Remember to restart IIS

Set-location "D:\Dll"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish            
$publish.GacInstall("D:\Dll\Ax2Json.dll")            
iisreset


Regards,

Monday, February 25, 2019

COC for class methods in D365

Hi,


COC- Chain of Commands are used to override the Application suite objects.
In certain cases, like the code with public and protected access specified methods cannot be created a post or pre event handler by coping its event.
In that case we need to go with COC.

This can be achieved by using the keyword ExtensionOf() to load the object and next() as super.
Note: COC class needs to final and method that to be COC can be public access specifier.
Example. COC of form button event.
//[ExtensionOf(ClassStr(ClassName)]
[ExtensionOf(classStr(SalesLineType))]
final class SalesLineType_Extension
{
    public void insert(boolean dropInvent, boolean findMarkup, Common childBuffer, boolean _skipCreditLimitCheck)
    {
        CustTable   custTable;       
        custTable = CustTable::find(salesLine.CustAccount);
        if(!custTable.CreditRating)
        {
             //Your  code to perform action before the event;
        }
        next insert(dropInvent, findMarkup, childBuffer, _skipCreditLimitCheck);       
              //Your  code to perform action After the event;
    }
}

Note: Please make sure you are creating methods with same number arguments and same pattern of arguments as well to the calling methods ie next.


Regards

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...