Cannot create a record in Address format lines (LogisticsAddressFormatLines). Address format: 0005, State or province.

By Vitaliy Glushchenko:

Job to fix the issue:
//Cannot create a record in Address format lines
static void fixCannotCreateRecordInLogisticAddrFmt(Args _args)
{
    LogisticsAddressFormatLines logisticsAddressFormatLines;
    LogisticsAddressFormatId    logisticsAddressFormatId = '0005'; //defaul value. This id more ofter meet
    Dialog                      dialog = new Dialog('We will delete lines from LogisticsAddressFormatLines for selected format. Are you sure?');
    DialogField                 dlgLogisticsAddressFormatId;

    dlgLogisticsAddressFormatId = dialog.addFieldValue(extendedTypeStr(LogisticsAddressFormatId), logisticsAddressFormatId);
    if (dialog.run())
    {
        logisticsAddressFormatId = dlgLogisticsAddressFormatId.value();
        if (LogisticsAddressFormatHeading::exist(logisticsAddressFormatId))
        {
            ttsBegin;
            delete_from logisticsAddressFormatLines
                where logisticsAddressFormatLines.AddrFormat == logisticsAddressFormatId
                ;
            ttsCommit;
            info(strFmt('Data for %1 was update, pleae run sync again', logisticsAddressFormatId));
        }
        else
        {
            warning(strFmt('Value %1 not found in Address format', logisticsAddressFormatId));
        }
    }
    info('done');
}

Run This job and selectaddressFormatId from error above.



Rerun synchronization.



Support The Author

 If you found value in what I share, I've set up a Buy Me a Coffee page as a way to show your support.

Buy Me a Coffee

Post a Comment


All Comments


No comments. Be the first one to comment on this post.

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics 365 FO.

Authors are allowed to set their own "buy me a coffee" link.
Join us.

Blog Tags