Hi, in the help I read:
"Even if you run the CHANGECOMPANY function, triggers still run in the current company, not in the company that you specified in the CHANGECOMPANY function."
and
Rec.CHANGECOMPANY('B'); Rec.FINDFIRST; Rec.MODIFY(TRUE); |
If you run the code in this example from Company A, it will modify Rec in Company B, but it will run the OnModify trigger in Company A.
This looks wrong.
So if write a code like
ExtTextHeader.CHANGECOMPANY("B");
ExtTextHeader.SETRANGE("Table Name",ExtTextHeader."Table Name"::"G/L Account");
ExtTextHeader.SETRANGE("No.","No.");
ExtTextHeader.DELETEALL(TRUE);
Since in ondelete trigger of ExtendedText Header table there is the following code
OnDelete()
ExtTextLine.SETRANGE("Table Name","Table Name");
ExtTextLine.SETRANGE("No.","No.");
ExtTextLine.SETRANGE("Language Code","Language Code");
ExtTextLine.SETRANGE("Text No.","Text No.");
ExtTextLine.DELETEALL(TRUE);
Should I expect that headers are deleted in Company B and lines (if any with same No.) are deleted in Company A?
*This post is locked for comments