\$("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

Hmm...in that case you may need to try to parse it out from the url.


Hi Brad,



When i am trying to access the article which you have mentioned in solution it is showing me some error. Could you please text the article name again


I think that documentation was taken down, but you can find something similar here:



Service Portal and client scripts


Hi Brad,

I have the same issue but I am unable to open the link which you have provided. Could you please help me out

sagarikamodiam
Tera Contributor

Hi Brad,



When i am trying to access the article which you have mentioned in solution it is showing me some error. Could you please text the article name again