- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 11:32 AM
How to checked two check box fields for different fields based on condition?
Scenario:
We have two fields 1. field1 check box created on incident form.
2. field2 check box created on cmdb_ci_computer table(form)
when we selected configuration item on incident form based on that two check boxes checked.
i wrote before business rule , Please correct me where i did mistake or Please provide any other solution.
Table : incident , condition : configuration item is not empty.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 11:47 AM
Hi @ramuv,
Please try this BR:
// Check if the configuration item is selected and is a computer
if (!gs.nil(current.cmdb_ci)) {
// Set the u_critical_ci checkbox on the incident
current.u_critical_ci = true;
// Query the cmdb_ci_computer table for the selected configuration item
var ciGr = new GlideRecord('cmdb_ci_computer');
if (ciGr.get(current.cmdb_ci)) {
// Set the u_critical_ci1 checkbox on the cmdb_ci_computer record
ciGr.u_critical_ci1 = true;
ciGr.update();
}
}
- Make sure that cmdb_ci is pointing to the correct configuration item and that the item is of type cmdb_ci_computer.
- Ensure that the field names u_critical_ci and u_critical_ci1 are correctly spelled and exist on their respective tables.
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 11:47 AM
Hi @ramuv,
Please try this BR:
// Check if the configuration item is selected and is a computer
if (!gs.nil(current.cmdb_ci)) {
// Set the u_critical_ci checkbox on the incident
current.u_critical_ci = true;
// Query the cmdb_ci_computer table for the selected configuration item
var ciGr = new GlideRecord('cmdb_ci_computer');
if (ciGr.get(current.cmdb_ci)) {
// Set the u_critical_ci1 checkbox on the cmdb_ci_computer record
ciGr.u_critical_ci1 = true;
ciGr.update();
}
}
- Make sure that cmdb_ci is pointing to the correct configuration item and that the item is of type cmdb_ci_computer.
- Ensure that the field names u_critical_ci and u_critical_ci1 are correctly spelled and exist on their respective tables.
Thank you, please make helpful if you accept the solution.