The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Catalog client script get Record Producer Name

amkatulak
Giga Expert

Hi all,

Is there a way to get the name of the record producer (or other values, i.e., Category, Catalog, etc) using a catalog client script?   I have a scenario where I am using a variable set in quite a few of my record producers.   I have a catalog client script running onchange for a variable in that variable set.  

Recently, we had a new requirement that for a subset of forms, this variable should be set onLoad, and not changed like it would be for the majority of forms.

So basically, I need to determine which form I'm on, and if it matches a certain condition, abort my onChange script.

Any help is appreciated.

Thanks!

1 ACCEPTED SOLUTION

Chandan23
Tera Expert

var cat_item_id   = gel('sysparm_id').value;
This will retrieve the catalog item sys_id.



so in catalog client script you can check   like


var cat_item_id   = gel('sysparm_id').value;


if(cat_item_id == 'sys_id_of_black_berry')


{



//perform your script


}


View solution in original post

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

There's an input element with the id sysparm_item_guid, so you could run the following in your client script to get the record producer id, then use that to grab the name and other attributes.



var cat_id = $('sysparm_item_guid').value;


Chandan23
Tera Expert

var cat_item_id   = gel('sysparm_id').value;
This will retrieve the catalog item sys_id.



so in catalog client script you can check   like


var cat_item_id   = gel('sysparm_id').value;


if(cat_item_id == 'sys_id_of_black_berry')


{



//perform your script


}