Alfasith AX

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

Sunday, May 15, 2022

renamePrimaryKey() in D365

 Hi,


In this article, we will discuss renamePrimaryKey(). 

In the operation of changing the value any of the primary key values in the system like CustId, VendId, PurchID, PersonnelNumberId, ProjID, etc needs to reflect its supporting relationed child tables.

This can be manually achievable by renaming on record Info of the particular form.

Here my case is to do the same through code for a large list of values.


CustTable CustTable;

ttsBegin;

select firstOnly CustTable where CustTable.AccountNum == "00445";

if (CustTable)

{

CustTable.AccountNum = "CUST-00445";

CustTable.renamePrimaryKey();

}

ttsCommit;

}


On running the above snippet, all the transactions got updated with the new values.

Regards,



No comments:

Post a Comment

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...