Business Rule to display info message containing list of CI records - Urgent Help Needed!!

Still Learning
Kilo Sage

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!!! 

1 ACCEPTED SOLUTION

Also,

change this

ciLst.push(affectedCIs.getValue('ci_item'));

To:

ciLst.push(affectedCIs.ci_item.name.toString());

Best Regards
Aman Kumar

View solution in original post

10 REPLIES 10

Aman Kumar S
Kilo Patron

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'));

 

Best Regards
Aman Kumar

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. 

Change this:

affectedCIs.addQuery("task", current.getUniqueValue());  

to:

affectedCIs.addQuery("task", current.getValue("parent"));  

Best Regards
Aman Kumar

@New Developer 

any follow ups needed?

Please mark the appropriate response as correct if it helped you answer your query.

Best Regards
Aman Kumar