AX 2012: crossCompany delete_from

Although we cannot use crossCompany keyword with delete_from command, we can still achieve the same functionality with some performance overhead as follows:

static void JobCCDel( Args _args )
{
    Table21 tab21a, tab21b;

    ttsBegin;
    while select crossCompany minof(ratingNum), dataAreaId from tab21a
        group by dataAreaId
    {
        changeCompany(tab21a.dataAreaId)
        {
            tab21b = null;
            delete_from tab21b
                where tab21b.ratingNum == tab21a.ratingNum;
        }
    }
    ttsCommit;
}

Leave a comment

Blog at WordPress.com.

Up ↑