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.

How to set RITM State Field based on SC Task State Field

Chaitanya Redd1
Tera Guru

Hello Team,

I have created new Catalog item and workflow. But here I need whenever I change state of SC Task then automatically RITM state has to be changed.

 

find_real_file.png

Thanks,

JRY

1 ACCEPTED SOLUTION

Hi,

Can you remove the condition for state changes to PendingValue?

BR: After Update

Condition: State changes && current.request_item.cat_item == 'yourCatalogItemSysId'

Script: whatever state changes on sc_task same to be updated in RITM

var gr = new GlideRecord('sc_req_item');

gr.get(current.request_item);

gr.state = current.state;

gr.update();

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

7 REPLIES 7

Thanks Ankur, it worked.

Hi Ankur,

While using the script i am getting below error in condition 

Condition : State changes && current.request_item.cat_item == 'yourCatalogItemSysID' 

JavaScript parse error at line (1) column (14) problem = missing ; before statement (<refname>; line 1)

can you please help.

Hi Ankur,

What if we have multiple Tasks,how will it work.

Thanks