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

suvro
Mega Sage
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();

 

 

Not Working????find_real_file.png

Line no. 4 is wrong 

it is 'request_item' not req_item and it should be under quotes ' '

one more point is now, If the CTASK is closed complete, the state of RITM and REQ(field-'request state') state also need to closed complete.

can you please help 

thankyou