can you access another codeunits variables during runtime via a get-Function?

kenyokenyo Member Posts: 30
Hi, so i wonder how long (global ) variable values are stored during runtime. Lets say i want to pass an error message (from CodeUnit A ) to another code unit ( CU B ) . could i for example store it in a global variable in CU A , call another CU B and then pull the global variable from CU A through a get-function? Or is there an even easier way ?


  • TallyHoTallyHo Member Posts: 373
    edited 2019-04-05
    Yes, what you describe is possible. Global variables will keep their value during runtime.
    A self-written get-function is the proper way to do it.
    It can even be stored longer than runtime, using the single instance property of the Codeunit.

    But the normal way of doing things is passing variable from CU A to CU B when calling CU B.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,597
    Yes, but error messages have easier ways
Sign In or Register to comment.