Another version of my multiple choice question I posed here.
Codeunit 50000:OnRun()Cust.INIT;Cust.INSERT;Cust.INSERT; // This duplicate statement has been put here intentionally
Codeunit 50001:OnRun()IF CODEUNIT.RUN(50000) THEN MESSAGE('OK')ELSE MESSAGE('LASTERRORTEXT: %1', GETLASTERRORTEXT);
Which error/message will occur when codeunit 50001 is being executed?
If you did run the code you could verify that answer 2 is the right one.
Now how about the next question: CODEUNIT.RUN #3
If I remember this, duplicated Inserts are not "catched" by "IF CODEUNIT.RUN", meaning that error no. 3 should pop-up.
What I did in those cases was:
1. use "if rec.insert then"
2. or use second codeunit which is trying to catch codeunit provided in the example above