Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

update state of incidents pending change when change is implemented

Teresa Ruiz
Tera Contributor

Hi,

 

How can i make a business rule to change incident state of incidents pending change when this change is implemented?

 

all help is welcomed 🙂

1 ACCEPTED SOLUTION

Apeksha Joshi
Kilo Guru

Hi Teresa ,

try this script :

write an after insert / update business rule on incident table 

var gr = new GlideRecord('change_request');

gr.addquery('parent',current.sys_id);

gr.addquery('state',7);

gr.query();

if(gr.next())

{

current.setValue('incident_state',6);

current.update();

}

 

Mark my answer correct and helpful based on impact.

Regards,

Apeksha

 

View solution in original post

5 REPLIES 5

Kunal Varkhede
Tera Guru

Hi,

Write After Business rule on change_request table. Condition would be

State changes to 6 (Give condition in When to run Section of business rule).//choose state as per your requirement so that this business rule will triggered as per the condition provided in Filter tab. 

You can try above script that @Namrata provided.

And one more thing while querying table use below addQuery() it also worked.

gr.addQuery('parent',current.getValue("sys_id"));

 

 

Thanks,

Kunal.