Find catalog item sys id from a variable set.

Geeky
Kilo Guru

Hi All,

I have a variable set that is being used in many catalog items. One of the variable values in the set has to change based on the catalog item. For that I need to find out which catalog item is opened?

I tried using g_form.getUniqueValue() which is giving me sys id of the catalog item but it's not working in Order guide.

Any help on this? It should work for individual items as well as order guides. I do not want to have redundant code.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

please check below links:

https://community.servicenow.com/community?id=community_question&sys_id=a3555ddddb36e3409540e15b8a96...

https://hi.service-now.com/kb_view.do?sysparm_article=KB0689536

can you try this: ensure isolate script is set to false

var catItemSysId = $("sysparm_id").value;

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

please check below links:

https://community.servicenow.com/community?id=community_question&sys_id=a3555ddddb36e3409540e15b8a96...

https://hi.service-now.com/kb_view.do?sysparm_article=KB0689536

can you try this: ensure isolate script is set to false

var catItemSysId = $("sysparm_id").value;

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Script is not getting invoked.

find_real_file.png

Hi,

Try this:

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

Hi Vishakha,

Script itself is not executing. You see I have added an alert statement to check if it is executing or not. It is not executing because I did not select catalog item in the script.

I do not want to create 100 client scripts if I have this variable set in 100 catalog items