CODEUNIT.RUN #2

Another version of my multiple choice question I posed here.

Given:

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?

  1. ‘OK’
  2. ‘LASTERRORTEXT: The Customer already exists. Identification fields and values: No.=”’
  3. ‘The Customer already exists. Identification fields and values: No.=”’
  4. none

Note

  • Variable Cust in codeunit 50000 is linked to the Customer table.
  • As before of course you’re free to test it in NAV, but first give it a try “from the bare head”.

One Comment

  1. 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

Leave a Reply

Your email address will not be published. Required fields are marked *