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.

Get sysid of Record Producer in Catalog Client Script

Constantine1
Giga Contributor

How do I get the sysid of the item about to be created through a Record Producer in a Catalog Client Script? To clarify, I am not looking in getting the sysid of the catalog item itself, but the record that will be produced once someone submits the request.

1 ACCEPTED SOLUTION

Constantine1
Giga Contributor

I think I found a way of doing by referencing a DOM element. The following code is giving me the sys_id in a catalog client script :


gel('sysparm_item_guid').value


I was hoping there was some function call I was missing but it doesn't look like that is the case.


View solution in original post

11 REPLIES 11

Hi Constantine,



I earlier had similar requirement where i was trying to find the sysID of the record producer instance which is going to create the record.


Thank you so much for detail about sysparm_item_guid. It saved lot of my time.



Thanks


Gaurav


restevao
Giga Expert

 

you can try to grab info off the URL

 

var sys_id = gup('sys_id', location.href);

function gup( name, url ) {
if (!url) url = location.href;
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return results == null ? null : results[1];
}