We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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?
6 REPLIES 6

@Debasis Pati 

not very sure then.

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Giga Sage

Hi 

 

Could you try with gr.update() in your code (if it is not in script include) and test it.

 

var gr = new GlideRecord('incident');
    gr.addquery('sys_id',current.task);
    gr.query();
    if(gr.next()){
       
        new TaskUtils().triggerRefreshImpactedServices(gr);
     gr.update();
    }
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: