Sunday 19 October 2014

DIXF / DMF Issue with Entities

Using DIXF requires a set of versatile skills from Excel to X++. I came across this issue where I kept getting the error below every time I uploaded various entities particularly Customer.

Results. Record ('XXX') . A record with RecId 0 does not exist.
Results. Record ('XXX') . Account  does not exist.
Results. Record ('XXX') . Update has been cancelled.
This issue was caused by incorrect lincence configuration when a field was passed on and the key was not enabled. Below code can be used to clean the data in the staging on the fly.
static void CLearCustomerEntityState(Args _args)
{
    DMFCustomerEntity cust;
    int counter;
    ;
        counter = 0;
    while select forUpdate cust where cust.TransferStatus == 2
    {
        ttsBegin;
             cust.State = "";
             cust.County = "";
        cust.AccountBalance = 0;
        cust.update();
        ttsCommit;

        counter++;
    }
    info(strFmt("Cleared : %1",counter));

}

No comments:

Post a Comment