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

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.


This is interesting,



So does it mean that sysparm_item_guid value would be used as an sys_id for record getting generated?



What record you are trying to generate ? Incident?


Hi Constantine



You are correct sir, i just tried with create incident record producer and it created an incident with the sys_id which is stored in "('sysparm_item_guid').value)"



This is what I also wanted to have in past but did not find any API.



I am now wondering how it works for RITM which gets created by catalog items .


Hi Deepak,
Thanks for verifying that it works for you also. I don't know how it would work on a RITM, but maybe providing the background / history of where this came from may provide clues.



The 'sysparm_item_guid' is a field used by the ServiceNow attachment process. In order for an attachment to be loaded into the attachment table, it needs to have a sysid of the record that the file will be attached to (e.g. in order to attach a file to an Incident, we need to have the sysid of the incident).   I don't know how ServiceNow is doing it specifically on their end whether in an Incident form, Record Producer, etc... but please refer to this post :   How to use a gr.newRecord sys_id that hasn't been inserted   on some plausible ideas on how they are getting a sysId before an item has been submitted.



I hope this background was of value.... I am happy to go into more detail if that would be useful. ~Constantine


Hi Constantine,



Thank you for detailed explanation, it helped



I would really appreciate if you could find the RITM sys_id which is getting generated via catalog item in advance.


Above method which works for incident does not seem to be working for RITM



I am also investigation on this.