Refresh impacted services automation not working

Debasis Pati
Kilo Sage

Hello All,

We have a oob ui action Refresh impacted services.
I want to automate the process like if any addition or deletion to affted ci's related list on incident happens then i want to refresh the imapcted ci's
When i checked the ui action refresh affected ci the beleow script was there

new TaskUtils().triggerRefreshImpactedServices(gr);

So what i did is i also created one after business rule on (task_ci)--->Affected ci's and checked insert and delete and wrote the below script
var gr = new GlideRecord('incident');
    gr.addquery('sys_id',current.task);
    gr.query();
    if(gr.next()){
       
        new TaskUtils().triggerRefreshImpactedServices(gr);
    }

Now when i manually add any affected ci's only refresh impact service initiated message is coming no update or addition is not happening to the impacted services/.ci' s related list.
But when i click on the refresh impacted services ui action by right click on the incident form then it brings the impacted services or ci's basically it again brings the same ci's what we have added in the affected ci's to the imapacted services list also but the br what i wrote it is not doing that why?

@Ankur Bawiskar any idea?
4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Debasis Pati 

what debugging did you do?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

there is no such differnce also the differnce is there in business rule i am passing the gr and in ui action script its directly current object.
Also in br i kept a addinfomessage just to check if it is goig inside the loop or not but it gives the message.still the issue.

@Debasis Pati 

did you check with that script include function by adding logs?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

the script include function is an snc one @Ankur Bawiskar