- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 10:30 AM
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.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 11:48 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 11:48 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 08:29 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 08:35 PM
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2016 11:41 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2016 11:11 AM
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.