How do you get the sys_id of a catalog item in a catalog client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 11:45 AM
I have a catalog client script on some of my forms where I need to know the sys_id of the catalog item itself (not the unique instance of the form record).
I have tried g_form.getParameter("sysparm_id") in an onload script and it's bringing back a sys_id that does NOT match the catalog item sys_id.
I have also used g_form.getUniqueValue() to no success. How do I get the catalog item sys_id back in my client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 12:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:29 AM
Hi,
I'm not using a record producer. It's a catalog item form where I need to get the sys_id of the item itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2018 07:42 AM
Hi drasamsetti
I built my code using g_form.getParameter("sysparm_id") and it works with onload client script on desktop. however it does work on service portal side here you have my code:
any help on this it would be appreciated
function onLoad() {
var sysID = g_form.getParameter('sysparm_id');
alert("SYS ID: " + g_form.getParameter('sysparm_id'));
var catalogName = new GlideRecord('sc_cat_item');
//catalogName.addEncodedQuery(encQuery);
catalogName.addQuery('sys_id',sysID);
catalogName.query();
while(catalogName.next())
{
g_form.setValue('cmn_item_name',catalogName.name);
}
}