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

Getting error : There is a JavaScript error in your browser console when I tried it.

g_form.getParameter("sysparm_id") 

I tried your code in my instance it works fine for me. It's populate sys_id.

 

DDo you see any mistake in my script?

Hi Geeky,

Execute below code only:

function onLoad() {

alert("Executed");

var guide= $('sysparm_guide').value;
alert(guide);
}

 

If it helps then please mark my answer Correct and Helpful.

Vishakha

Same statement g_form.getUniqueValue() worked for order guide as well with isolate script unchecked.