Alfasith AX

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

Sunday, June 8, 2014

To duplicate a record in the same table in Dynamic AX

Hi,

static void ToDuplicate1RecordIntoSameTable(Args _args)
{
MyTable MyTable1;
MyTable MyTable2;
MyTable1 = myTable::find('0000526');
ttsBegin;
MyTable2.data(MyTable1);
MyTable2.HcmPersonnelNumberId = '000555'; // Index fileds needs to changed else it throws error
if (!MyTable2.validateWrite())
{
    throw Exception::Error;
}
MyTable2.insert();
ttsCommit;
    info("Duplicate record inserted");
}

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