- 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-20-2023 01:47 AM
my code is same. But still its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 02:06 AM
Hello @Poorva Bhawsar
I have provided you the code with added logs inside so did you checked the logs? and at what point the code is not working? are you able to get the variable values in the logs?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 02:16 AM
Did you add additional logs to debug provided script?
Which loop it is going and what values you are getting?
Also share all your variable names and types.
If possible screenshots.
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 02:03 AM
Hi,
Please use below:
if (current.variables.oat_type == 'Server') {
gs.info('Inside Server condition');
var server_name = current.variables.server_name_s;
var grCI = new GlideRecord('cmdb_ci');
grCI.addEncodedQuery('sys_idIN' + server_name.toString());
grCI.query();
while (grCI.next()) {
if (current.variables.server_privilaged_account_onboarded_to_piam == 'accept') {
grCI.u_tpam == true;
}
if (current.variables.database_onboarded_to_siem_confirmation_approval == 'accept') {
grCI.u_siem == true;
}
if (current.variables.cis_scan_nessus_scan_passed_confirmation_approval == 'accept') {
grCI.u_nessus == true;
}
if (current.variables.ds_am_av_and_network_protect_with_ips_policy_is_set_to_prevent_or_ms_defender_installed == 'accept') {
grCI.u_av_am_ips == true;
grCI.u_xdr == true;
}
grCI.update();
}
} else if (current.variables.oat_type == 'Database') {
var server = [];
var mrvsParsed = JSON.parse(current.variables.mrvs_contain_server_name.toString()); // use MultiRow Variable set backend name here
for (var x in mrvsParsed) {
server.push(mrvsParsed[x].server_name.toString());
}
var gr1 = new GlideRecord('cmdb_ci');
gr1.addEncodedQuery('sys_idIN' + server);
gr1.query();
while (gr1.next()) {
if (current.variables.server_privilaged_account_onboarded_to_piam == 'accept') {
gr1.u_tpam == true;
}
if (current.variables.database_onboarded_to_siem_confirmation_approval == 'accept') {
gr1.u_siem == true;
}
if (current.variables.cis_scan_nessus_scan_passed_confirmation_approval == 'accept') {
gr1.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.update();
}
}
Replace the name of MRVS variable set in Database section, follow the comment. Also make sure you are using correct variable names in script.
Note : Before saying not working try adding some logs to check and debug script at your end. which loop it is going, what values you are getting etc and share the outcome. We are just assuming variable names and providing logics. Minor corrections should be done by you on your instance.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 09:17 PM
I am getting all the logs but the log which is there after updating the record is only returning a sys id. Its a list collector when oat type is server so it should update all. Also its not updating that one record also whose sys id its returning.