Options

Sharing variables in codeunit

jksjks Member Posts: 277
Hello,

I have created one codeunit with two functions. In C/AL Globals i have declared one variable of type bigtext.

One function is 'assignvalue()' in which i am assigning value to bigtext variable. Then in second function i want to use the value of that bigtext variable. But my bigtext variable becomes empty in the second function.

How to preserve the value of bigtext in the second function?

Thanks for any help.

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,090
    Between the calls, you cannot do a CLEAR(MyCodeunit) because this clears all globals in the codeunit.
    If the 2 functions are called by different objects, you need to put property SingleInstance=yes in the codeunit.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    jksjks Member Posts: 277
    Thanks.
Sign In or Register to comment.