Sai Kumar B
Mega Sage
Mega Sage

We have a global utility called GlobalServiceCatalogUtil in ServiceNow to retrieve information related to Catalog items, one of the interesting functions is getVariablesForTask It retrieves all the variables associated with SCTASK in JSON format. Handy util to use in automation scripts.

Pointer: This util is open for any scope but not for modification/extension.

Sample format:
var getVariables = new GlobalServiceCatalogUtil().getVariablesForTask(<pass sc_task rec object>, true);

Parameter 1 is the SCTASK object
Parameter 2 is a boolean, to indicate whether or not to add MRVS in the returned result.

Comments
Eric106
Tera Explorer

I just discovered this utility today, but it would have been nice to know about years ago. There doesn't seem to be anything on docs.servicenow.com or in the API reference about this class. This post is the first result if I google the class name.

Version history
Last update:
‎06-06-2022 11:22 PM
Updated by: