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 update the CatLog item variables data from the workflow script activity

hemantnh
Tera Expert

how to update the CatLog item variables data from the workflow script activity

3 REPLIES 3

AndersBGS
Tera Patron
Tera Patron

Hi @hemantnh ,

 

 please elaborate a little further  - what are you trying to achieve?

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

kaushal_snow
Giga Sage

@hemantnh ,

 

You can update catalog item variable data in a workflow script activity, but you have to do it on the requested item (RITM), not the catalog item directly...

 

var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.sys_id)) {
ritm.variables.your_variable_name = 'new value';
ritm.update();
}


Alternatively, in Flow Designer, you can use a custom Action (script type) to set a catalog variable:

 

inputs.requested_item.variables[inputs.variable_name].setValue(inputs.variable_value);
inputs.requested_item.update();
outputs.state = 'success';

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/