- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2022 10:41 AM
How to update a Variable Value in the Catalog Tasks using Fix Script.
Details :
I have a Variable "open source" and its type is select box , it has values { None, Yes, No} and its on one of the catalog Item , the catalog item is used to retire a business apllications
Now I have more Tasks for retiring a business apllications and now on all these tasks the Variable "open source" should be updated with value "No"
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2022 10:52 AM
Here's the Fix script you need:
var fieldObj = new GlideRecord("sc_item_option");
fieldObj.addQuery("item_option_new", '<<variable sys id from catalog item>>');
fieldObj.query();
while (fieldObj.next()) {
fieldObj.value = 'Yes'; //Use right backend name
fieldObj.update();
}
Warning : Be careful with fix scripts, if possible run it for 1 RITM and verify the results.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2022 10:52 AM
Here's the Fix script you need:
var fieldObj = new GlideRecord("sc_item_option");
fieldObj.addQuery("item_option_new", '<<variable sys id from catalog item>>');
fieldObj.query();
while (fieldObj.next()) {
fieldObj.value = 'Yes'; //Use right backend name
fieldObj.update();
}
Warning : Be careful with fix scripts, if possible run it for 1 RITM and verify the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 03:30 AM
Hi Anirudh,
It did not work.
I have 70 Tasks created in the sc_task Table , the Tasks are created for the catalog item "Retire business application" and it has the Variable Open_source
Now I should update Variable open_source=No on all those 70 Tasks , hope this gives some good understanding on the Requirement .
Please help with it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 06:41 AM
I hope you are using the right sysid in the query. ( it needs to be the sysid of the variable open_source).
Also, try
fieldObj.value = 'no'; //Use right backend name
It should update the field on the RITM's variable editor and also on the task's variable editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 08:33 AM
Anirudh,
How can i test it for only 1 Request Item,
lets say my RITM is RITM4596087096 and sys id is aadsdf89465905lfmglh
and in the Table sc_item_option , I could see only cart item, I dont find the cat item or sc cat item option against the variable Open source
fieldObj.value = 'no'; //Use right backend name
Here right backend name is the backend name of Variable Right?
I have doubt , no where in the above code we are querying the RITM or Task but how could our code update the variable value against each RITM