Alfasith AX

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

Thursday, March 25, 2021

Generate script to recreate the DDL with data and without data

Hi,

To recreate the DDL please follow below procedure


If you would like to generate the script with data please select Advance in that Advanced Scripting Option please select the type of data to script : Schema and data



on Successful finish of this wizard will open a script window and we can save or share to other instance to regenerate the DDL

Regards


Wednesday, March 24, 2021

Adding admin user in to D365 instance

 Hi,

There are 2 ways to add admin user in to an instance.

1. System Administrator \ User \ Import from Acive Directory.

2. Using admin user provisioning tool.


Using admin user provisioning tool.

1. Run the AdminUserProvisioning shortcut placed in desktop of AOS server.

2. Enter the email address of the account has AAD ( Azure Active directory) and Submit.



Note: Shortcut is not available in desktop, please check below URL

https://alfasith.blogspot.com/2021/03/how-to-add-dynamics-365-admin-user.html


Regards

How to add Dynamics 365 admin user provisioning tool in desktop

 Hi,


During VM creaction, we may missed out to add the shortcut of user provisioning tool in desktop, for that we have to manually create the shortcut from the installed exe run file.

C:\AOSService\PackagesLocalDirectory\bin\AdminUserProvisioning.exe

Add shortcut to desktop for selected file.

Regards,




Tuesday, March 9, 2021

Extend / Customize standard CanSubmitToWorkflow in D365

Hi,


We cant override CanSubmitToWorkflow to return our boolean on any eventHandler's return like eventHandler of ValideWrite(). To achiew we have to set the args of CanSubmitToWorkflow() to be decided by our code.

[PostHandlerFor(formStr(CustTable), formMethodStr(CustTable, canSubmitToWorkflow))]

    public static void CustTable_Post_canSubmitToWorkflow(XppPrePostArgs args)

    {

        FormRun     form = args.getThis();

        FormDataSource      custTable_ds = form.dataSource(formDataSourceStr(custTable,CustTable)) as FormDataSource;

        custTable           custTable    = custTable_ds.cursor();

        if (custTable.RecId && custTable.DocumentStatus == DocumentStatus::NotSubmitted)

        {

            args.setReturnValue(true);       

        }

        else

        {

            args.setReturnValue(false);

        }

    }


Regards,

Monday, February 22, 2021

How to achieve table relation in SQL without primary index 1:n

HI,

Select particular parent table (master table) db.table.
1. Right click select design

2. Select the respective field where we have to achieve unique index but not primary.
Right click on that filed select Indexs/keys...



3. Add the select the column to from that list and please make sure you change the property to YES in isUnique.


4. Save and select the design of transaction table where we try to achive Foreign key.
Right click on that particular filed and choose Relationships..


5. Add the relationship by select the tables and columns specifics.




Regards,

 

Thursday, February 18, 2021

RandomNumbers In AX /D365

 Hi,


static void CreateRandomNumbersInAX(Args _args)

{

    RandomGenerate randomGenerate;

    ;

    randomGenerate = RandomGenerate::construct();

    randomGenerate.parmSeed(new Random().nextInt());

    info(int2str(RandomGenerate.randomInt(0,2147483647)));   //RandomInt(RangeFrom,RangeTo)

    //Note: Range from should be more than natural number 0 and more.

 

}

OutPut

1786303728


To understand the formula behind this random number please refer randomInt() in RandomGenerate class.

The formula in randomNumber generation is not similar to library function of dotnet.

Note: We cannot treat this randomGenerated Values as primary key, this may repeat with same range.

Regards,



Get a table ID in SQL / table browser - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' <URL>/?cmp=<CompanyID>&mi=sysTableBrowser...