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.

change "State" field value of request item table as per sc_task table

Balaji Kanduku2
Tera Contributor

Hai Guys,

please help me in the scripting, im new to servicenow,

i have 2 tables, if i change "State" field value of request item table as per sc_task table.

 

please give any script

thanks

 

1 ACCEPTED SOLUTION

suvro
Mega Sage

You can use after Business Rule on sc_task table 

Condition 

state changes

Script

var ritmGr = new GlideRecord('sc_request_item');

ritmGr.get(current.getValue('request_item'));

ritmGr.state = current.getValue('state');

ritmGr.update();

 

 

View solution in original post

8 REPLIES 8

//To Close RITM

var ritmGr = new GlideRecord('sc_request_item');

ritmGr.get(current.getValue('request_item'));

ritmGr.state = current.getValue('state');

ritmGr.update();

//To Close Request

 

var reqGr = new GlideRecord('sc_request');

reqGr.get(current.getValue('request_item.request'));

reqGr.state = current.getValue('state');

reqGr.update();

Please mark my response as correct, if it resolved your issue

@Balaji Kandukuru 

Please close this thread my marking the appropriate response as correct so that others readers can also benefit from it.

suvro
Mega Sage

@Balaji Kandukuru 

Please close this thread my marking the appropriate response as correct so that others readers can also benefit from it.