Automic Workload Automation

 View Only

 How to change object variable

Jump to  Best Answer
Christau's profile image
Christau posted Feb 03, 2022 01:12 AM
Hi All,
my question is how can I modify an object variable via the process script?
For example I created a TEST.JOB which has the variable #MY_VAR and the value is empty

And then in the process script I want to change the value of this var to "test"


But this is not working. If I look into the object variable, it still is empty.
Am I doing anything wrond, or did I misunderstood thwe concept of object variables?

Many thanks in advance for any help on that.
-chris-



Peter Grundler's profile image
Broadcom Knight Peter Grundler  Best Answer
Hello Chris,

the content of such a variable can only be changed during runtime (=temporarely).

There is no method to change the JOBS permanently - in order to do so you would have to change the object definition which is not possible via AE script.

One of the benefits is that child tasks can inherit object variables from parent objects. You can also use :PUBLISH to pass object variables to the parent or top level object.

regards,
Peter
Christau's profile image
Christau
Thanks @Peter Grundler for the clarification!​
Joel Wiesmann's profile image
Joel Wiesmann
- Create a STATIC.VARA object (VARA.WORKAROUND).
- Enter a record. Example: key = "MY_VAR" value = "test".
- In TEST.JOB in variables for &MY_VAR use {VARA.WORKAROUND,MY_VAR} as value

If you want to permanently change the value, use
:PUT_VAR VARA.WOKRAROUND, MY_VAR, "new value"

You basically just outsource the value to the VARA. I didn't test the above so there's a risk for typos, but should do it ;-).