- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 01:38 AM
Hi Community,
When user selects some variables values as approved from the dropdowns on catalog task, i want to check some checkboxes on the cmdb_ci form.
For e.g., if xyz is selected as approved from the dropdown list, then it should check xyz checkbox on the cmdb_ci form before closing the request.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 10:27 PM
Hi,
it was not working because you changed the variable names for GlideRecord (you were using 'grCI' it should be 'gr1')
Try below:
else if (current.variables.oat_type == 'Database') {
var server = [];
var mrvsParsed = JSON.parse(current.variables.doat_server_details.toString());
for (var x in mrvsParsed) {
server.push(mrvsParsed[x].server_name.toString());
}
//var server = current.variables.doat_server_details.server_name.toString();
gs.log("OAT Type: Database, Server Name: " + server, "YourScriptName");
workflow.info("OAT Type: Database, Server Name: " + server);
var gr1 = new GlideRecord('cmdb_ci');
//gr1.addQuery('name', server);
gr1.addEncodedQuery('sys_idIN' + server.toString());
gr1.query();
while (gr1.next()) {
if (current.variables.privilaged_account_onboarded_to_piam_confirmation_approval == 'accept') {
//gr1.u_tpam == true;
gr1.setValue('u_tpam', true);
}
if (current.variables.database_onboarded_to_siem_confirmation_approval == 'accept') {
//gr1.u_siem == true;
gr1.setValue('u_siem', true);
}
if (current.variables.cis_scan_nessus_scan_passed_confirmation_approval == 'accept') {
//gr1.u_nessus == true;
gr1.setValue('u_nessus', true);
}
if (current.variables.ds_am_av_and_network_protect_with_ips_policy_is_set_to_prevent_or_ms_defender_installed == 'accept') {
//gr1.u_av_am_ips == true;
//gr1.u_xdr == true;
gr1.setValue('u_av_am_ips', true);
gr1.setValue('u_xdr', true);
}
gr1.update();
gs.log("Updated your_multiline_text_variable_set_table record for Database - Sys ID: " + gr1.sys_id, "YourScriptName");
workflow.info("Updated your_multiline_text_variable_set_table record for Database - Sys ID: " + gr1.sys_id);
}
}
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 09:12 PM
Hi,
The script I have shared does not have login for insert/create new CI. It should only update CI if it is already exist.
In order to create new record we have to use gr.insert(). It is not used in the script. Please check if you have any other logic to create CIs.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 09:16 PM
Hi Anil,
You misunderstood the above msg. I dont want to insert a new record, i just want to update the current record but instead of updating the current record, its inserting 2 new records for one of the ci i have selected not for both. I mean its not working as per the expectation.
I just want to update the current record. For e.g., i have selected 2 cis in the list collector variable on the catalog item as xyz and abc. For xyz we need to update xy checkbox on that particular ci and for abc we need to update ab checkbox on that particular ci.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 09:32 PM
Yes, that's what script is doing.
There must be any other script that is creating CI's.
If you want you can add logs to print the sys-id's of records updated by our script.
We have not written script for insertion so there is no way to create/insert new CI.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 09:03 PM
Hello @Poorva Bhawsar,
You can create one Business Rule with 'After > Update' on the Catalog task table. And in the script logic, you can check the required field from the catalog task table is approved or not. And if it is approved, you can user the GlideRecord on the cmdb_ci table with appropriate query to check the checkboxes to TRUE for the desire fields.
If above answer resolve your issue, Please mark the solution as 'Accepted Solution' and also mark it as 'Helpful'.
Thank You!
Prathamesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 09:13 PM
I already have a run script and i am doing exactly same but instead of updating its inserting 2 new records with the checkboxes checked.