- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2020 09:44 PM
Hi All ,
We try to auto populate the Impacted services based on affected CI in change/incident form , How to achieve this ?
As of now , if we choose CI in configuration item field , it will show the same CI in affected CI tab & want to populate impacted services related this CI
We have dependency map/relationship in CMDB , but we don't have Service mapping ITOM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2020 11:17 PM
Hi,
Steps below
1) create after insert BR on task_ci table with valid condition so that it works only for INC and CHG
2) then for each insert insert record into task_cmdb_ci_service with the value from CI and Task from Task CI Table
Condition: current.task.number.startsWith('CHG') || current.task.number.startsWith('INC')
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('task_cmdb_ci_service');
gr.initialize();
gr.cmdb_ci_service = current.ci_item;
gr.task = current.task;
gr.insert();
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2020 11:17 PM
Hi,
Steps below
1) create after insert BR on task_ci table with valid condition so that it works only for INC and CHG
2) then for each insert insert record into task_cmdb_ci_service with the value from CI and Task from Task CI Table
Condition: current.task.number.startsWith('CHG') || current.task.number.startsWith('INC')
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('task_cmdb_ci_service');
gr.initialize();
gr.cmdb_ci_service = current.ci_item;
gr.task = current.task;
gr.insert();
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 12:24 AM
Also if we remove any affected ci tab , that need to remove in Impacted services ??
The second point , below script i can try to get all child related CI to populated , is not works
var services = current.ci_item;
var gr= new GlideRecord('task_cmdb_ci_service');{
for (var i = 0; i < services.length; i++) {
gr.initialize();
gr.cmdb_ci_service = services[i];
gr.manually_added = false;
gr.insert();
}
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 12:35 AM
Hi,
for removal you would require Before delete BR on task_ci table
I didn't get what is requirement for 2nd point
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 04:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 04:28 AM
Not much sure on that part.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader