- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 04:37 AM
Hi all.
I have a task in a workflow with a variable. If you select "NO" in this variable, you go to another task and when you close this task , you back to the other task and in this moment i want to restart the value of this variable but i dont know how.
The cuestion is, how can I set the value of a catalog task variable?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 04:45 AM
Because the variables in the catalog task are shared from the request item, you can simply change the variable on the request item.
Therefore you need a Run Script with something similiar to:
// current is the GlideRecord referencing the Requested Item
current.variables.my_variable = 'new value';
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 04:45 AM
Because the variables in the catalog task are shared from the request item, you can simply change the variable on the request item.
Therefore you need a Run Script with something similiar to:
// current is the GlideRecord referencing the Requested Item
current.variables.my_variable = 'new value';
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 03:53 PM
Hello, I am currently doing a workflow and I am placing an approver per group of assignments.
But now I have to do another one, with a RITM variable, but in the advanced options, I don't get the option to add the variable.
How do you recommend doing the code, or how can I visualize the variable I require.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 04:53 AM
The variables in a catalog task are actually the variables in the RITM.
When you want to change a value of a variable in the workflow, all you need to do is call something like this:
current.variables.<your_variable_name> = 'value';
If you do this inside of a task script you don't need to call anything like current.update() for the change to be saved, in fact, you want to avoid current.update() in a workflow as it can cause some strange behavior.
If you did need to use current.update(), you'd probably want to use:
current.setWorkflow(false);
current.update();
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 04:55 AM
Sorry, yes as Sebastian has already pointed out (didn't see his reply until I posted mine). The only addition is, again, you don't need to use current.update() if you set this inside of the workflow.