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

kenyokenyo Posts: 12Member
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 Posts: 230Member
    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 Posts: 1,570Member
    Yes, but error messages have easier ways
Sign In or Register to comment.