Monday, May 6, 2019

Duplicate records in Dynamics 365 Operations using X++


Example below can be used as sample code to find duplicate records from table using X++, either in AX 2012 or Dynamics 365 for finance and operations.

static void rdWrkCtrValidationDupRecords(Args _args)
{
    rdWrkCtrValidation  wrkCtrValidation;

    while select count(RecId) from wrkCtrValidation
        group by wrkCtrValidation.WrkCtrId
    {
        if(wrkCtrValidation.RecId >1)
        info(strFmt('%1 - %2',wrkCtrValidation.WrkCtrId, wrkCtrValidation.RecId));
    }

}

Query in SQL for similar requirement.

SELECT

    WRKCTRID,OUTPUT,COUNT(*)
FROM
    rdWrkCtrValidation
GROUP BY
    WRKCTRID,OUTPUT
HAVING
    COUNT(*) > 1
    



Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now