AX 2012: crossCompany insert_recordset

Posted on Updated on

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

static void JobCCIns(Args _args)
{
    Table21 tab21;
    Table22 tab22;

    ttsBegin;
    while select crossCompany actionDate, name, dataAreaId from tab21
        where tab21.actionDate > str2Date('1998-01-22', 321)
    {
        changeCompany(tab21.dataAreaId)
        {
            tab22 = null;
            tab22.actionDate = tab21.actionDate;
            tab22.name = tab21.name;
            tab22.insert();
        }
    }
    ttsCommit;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s