The CreatorCon Call for Content is officially open! Get started here.

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this you can do using after update BR on sc_task table; workflow is not proper approach for this

BR: After Update

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

Script:

// do what is required

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

Sorry Ankur, I didn't get you. Can you explain me with the script because here if change state on catalog task to "pending" then on RITM state field has to change to "pending" or state changes to closed incomplete then ritm state has to be changes to closed incomplete.

I have tried below script but it's changing for specific state itself but I need it for all states

Condition: current.state.changesTo("PendingValue")

 

Script:

 

var gr = new GlideRecord('sc_req_item');

 

gr.get(current.request_item);

 

gr.state = "PendingValue";

 

gr.update();

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