- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 07:48 PM
Hello,
I have a requirement to create an information popup message that also lists out affected CI records when a release task is created. The message should state: "The following CIs are impacted by work done in this release". I am familiar with using gs.addInfoMessage for the message, but am really struggling to write the business rule so that the affected CIs are also listed. Any help is greatly appreciated!!!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 10:09 PM
Also,
change this
ciLst.push(affectedCIs.getValue('ci_item'));
To:
ciLst.push(affectedCIs.ci_item.name.toString());
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 09:24 PM
You just need to glide "task_ci" table and check against the task field and in a while loop you can fetch details of CIs and show them in the addinfomessage.
You can use After Insert BR
var ciList = [];
var affectedCIs= new GlideRecord('task_ci');
affectedCIs.addQuery("task", current.getUniqueValue());
affectedCIs.query();
while (affectedCIs.next()) {
ciLst.push(affectedCIs.getValue('ci_item'));
}
if(ciList.length > 0)
gs.addInfoMessage("Below are the affected CIs: "+ciList.join('\n'));
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 09:45 PM
Hello Aman!!
THANK YOU so much for your reply!! I REALLY need the help!!! Unfortunately, the script you've provided does not actually work in my instance. I believe it's because the affected CIs are in a related list on the parent record rather than the child record. How can I get the script to work given that context? Please advise.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 09:55 PM
Change this:
affectedCIs.addQuery("task", current.getUniqueValue());
to:
affectedCIs.addQuery("task", current.getValue("parent"));
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2022 10:03 PM
any follow ups needed?
Please mark the appropriate response as correct if it helped you answer your query.
Aman Kumar