You might stumble on an issue where you declare one variable of a table and use it for more than 1 company select. It will not work properly if you want to save it. The best approach is to create separate variable for each company. For some reason, AX doesn't clear the DataAreaId on the object such as table. Even if you set it to null.
Example: Will not work properly.
CustTable CT;
;
CT.AccountNum = 'test';
....
CT.insert();
CT = null;
changecompany('2ndcompany')
{
CT.AccountNum = 'test2';
CT.insert();
}
Correct Approach
CustTable CT,CT2;
;
CT.AccountNum = 'test';
....
CT.insert();
CT = null;
changecompany('2ndcompany')
{
CT2.AccountNum = 'test2';
CT2.insert();
}
No comments:
Post a Comment