- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 07:25 AM
Hi,
In change request, there is already a related list of affected cis, there can be multiple affected cis in this related list.
I want to populate all those affected cis in related list of change task affected cis. These change tasks are getting populated in change request at implement state in related list 'Change Tasks'.
Note: I can already see a related list tab in change task for affected cis, as we do not want another related list tab for affected cis.
Please suggest a business rule for this as we do not want a new relationship !!!!!!
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 07:37 AM
Hi,
you can use this logic to link those affected Cis to Change task
BR: After Update on Change Request
Condition: State [Changes to] Implement
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var rec1 = new GlideRecord("change_task");
rec1.addQuery("change_request", current.getUniqueValue());
rec1.query();
while(rec1.next()){
var gr = new GlideRecord("task_ci");
gr.addQuery("task", current.getUniqueValue());
gr.query();
while(gr.next()) {
var rec = new GlideRecord("task_ci");
rec.initialize();
rec.task = rec1.getUniqueValue();
rec.ci_item = gr.ci_item;
rec.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
‎05-24-2022 04:00 AM
Hi Ankur,
It is working for few changes but not working for other changes. It might be an issue with the existing configuration.
But thanks a lot. It worked!!!