Pages

Tuesday, September 4, 2018

D365FO: Renaming the primary key through coding

Noted:  This content is based on Dynamics 365 for Finance and Operations version 8.0 Platform Update 15 



Scenario: 

Rename many customer names. 


Solution: 

If the table has many relations, it will take a long time to rename through the record information one by one.  We can use the table method renamePrimaryKey() in a batch class and run in batch mode.   


     CustTable custTable;
     ttsBegin;
     select firstOnly custTable
         where custTable.AccountNum == 'XXXX-WC-00002';
     if (custTable)
     {
         custTable.AccountNum = 'XXXX-WC-00001';
         custTable.renamePrimaryKey();
     }    
     ttsCommit;





4 comments:

  1. Authentic content..very knowledgeable.. thanks for this post.
    Tally on Cloud Server
    Tally on AWS

    ReplyDelete
  2. Great post! This explanation on renaming the primary key in D365FO is really helpful and clearly written. It made the whole process much easier to understand.

    Also, for anyone looking to expand their cloud skills, check out this AWS Cloud Course – it’s a great resource to get started with AWS.

    ReplyDelete