- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 02:27 AM
Hi Community,
I want to change the value of CI state from abc to xyz selected on the CI list collector field of a catalog item using workflow.
This is what i did so far.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 11:12 PM
Hi,
Use below script:
var CIList = current.variables.server_name_s.toString();
var grCI = new GlideRecord('cmdb_ci_computer');
grCI.addEncodedQuery('sys_idIN' + CIList);
grCI.query();
while (grCI.next()) {
grCI.operational_status = 1;
grCI.update();
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 02:55 AM
But which request sys id i need to use. It will vary everytime. I have this code in my run script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 09:32 PM
Hi,
If you are using workflow for catalog item then you just need below logic in run script activity.
var CIList = current.variables.server_names.toString(); //replace server_names with your List collector variable name
var grCI = new GlideRecord('cmdb_ci');
grCI.addEncodedQuery('sys_idIN'+CIList);
grCI.query();
while(CIList.next()){
CIList.operational_status = 'your new value'; // use field name and value as per your requirement
CIList.update();
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 10:32 PM
It seems the script is correct but based on my requirement i need to have an approval on catalog task but that approval is triggering on sc_req_item table and post approval nothing is updating in the respective tables.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 10:43 PM
Hi @Poorva Bhawsar can you please share how approval is triggered on SC Task?
If it is through workflow then you can add run script activity after approval activity.
Other wise you need to create a Business rule and use script in BR to update CI's.
The choice BR and Table is depend on your current configuration.
Thanks
Anil Lande