Customize System Variables ??

IrishGiriIrishGiri Member Posts: 61
Hi all,

Is it possible to create your own system variables?? For examle, could I create my own system global variable MYVAR, that I could call in code just like USERID or TODAY.

Thanks,
Paul.

Comments

  • jorgitojorgito Member Posts: 115
    You can create a Single Instance Codeunit with variables and functions that alter the variables.

    Then, all you have to do is create a Codeunit variable and use the variables and functions. The value of the variable will be the same in any object that uses it.

    For example,

    create Codeunit 50000 MyData and in there create variable MyVar.

    You can set this variable in an object, e.g.
    MyData.MyVar := 'Data';
    

    and then in another object you can display this variable, e.g.
    MESSAGE(MyData.MyVar);
    
    It will display 'Data'.
Sign In or Register to comment.