\$("sysparm_guide") doesn't work in Service Portal

scwillson
Mega Guru

I have a Catalog Client Script that acts on the form only when the item is being filled out in a specific Order Guide. However, we are trying to get everything to work in the Service Portal in Helsinki, but it seems that the $("sysparm_guide") in the Client Script no longer pulls the sys_id of the guide being used.

I can try to work around it by having a hidden variable that populates from the cascading variable, which in turn will perform the same actions, but I wanted to see if anybody knows how the Guide being used can be identified from the Service Portal.

function onLoad() {

      var guide = $("sysparm_guide");

  if (guide.value == 'bf2b9d31130de6002d763d27d144b082') { //Standard New Hire Order Guide

  g_form.setValue('service','new');

  g_form.setDisplay('service',false);

  }

}

I can tell that the URL is different for the Service Portal, and it does only show the sys_id of the guide being used. How would I pull the sys_id from the URL efficiently?

https://instance.service-now.com/sp?id=sc_cat_item_guide&sys_id=002a1ead135d2200a9aeff82e144b088

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Simon,



Service Portal doesn't support any DOM techniques like jquery or prototype as explained in the article I linked to below. However, if you scroll all the way down to the bottom it addresses how to determine whether you're in an order guide or not.



documentation/client_scripting.md at master · service-portal/documentation · GitHub


View solution in original post

9 REPLIES 9

devi_putra
Kilo Guru

Hi Simon,



Could you please try:



var guide = $("sysparm_guide").value;


instead of------> var guide = $("sysparm_guide");



Hope this will help you.



Thanks,


Devi



PS: Hit like, Helpful or Correct depending on the impact of the response.


Tried it, but it didn't make any difference.


Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Simon,



Service Portal doesn't support any DOM techniques like jquery or prototype as explained in the article I linked to below. However, if you scroll all the way down to the bottom it addresses how to determine whether you're in an order guide or not.



documentation/client_scripting.md at master · service-portal/documentation · GitHub


Thanks Brad.



isOrderGuide() works great, except that it only returns a boolean value. Is there any way that you know of that I could identify specifically which order guide is it?