Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How do you get the sys_id of a catalog item in a catalog client script?

e_wilber
Tera Guru

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?

9 REPLIES 9

Jaspal Singh
Mega Patron
Mega Patron

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.


drasamsetti
Kilo Expert

Hello Eric,



g_form.getParameter("sysparm_id") perfectly works with onload client script



find_real_file.png


find_real_file.png



Let me know if you have any issues with you client script, happy to help.



Thanks,


-Durga.




Hit Like or Correct on the impact of response.


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); 
}

}