When you run code in company "A" like:
Rec.CHANGECOMPANY('B');
Rec.INSERT(TRUE);
The onInsert trigger runs in company "A"
So we know that for CHANGECOMPANY we should always do INSERT(FALSE)
I was curious what would happen with
Events.
If I move my code from the onInsert to an onAfterInsert listener instead.
Turns out that the event is picked up, and runs in the original company, similar to the old triggers. But there's no explicit way to opt out of the listener firing.
Another good reason to put
IF NOT RunTrigger THEN EXIT;
in the beginning of many event listeners.
Anyways... just sharing...
Answers