How to get entire URL in Client Script OR sysparm

Sanjeev Kumar1
Kilo Sage

Hi All,

I have created a custom table for new record system give us a URL Like.

x_abc_manage_app_app_req.do?sysparm_stack=x_ncrrp_manage_app_app_request_list.do&sys_id=-1

I want to pass one more parameter like

x_abc_manage_app_app_req.do?sysparm_stack=x_ncrrp_manage_app_app_request_list.do&sys_id=-1&sysparm_ab_id=2345t56y7u7

I what to get this parameter in onload client Script.

Please let me know how we get this value in Client Script.

Thanks,

Sanjeev Kumar

1 ACCEPTED SOLUTION

Sanjeev Kumar1
Kilo Sage

Hi All,


If you change application Scope global



window.parent.location.href



Code will work. I thing there are some BUG in Fuji.


Now when I change scope global it is working.



Thanks,


Sanjeev Kumar


View solution in original post

14 REPLIES 14

Sanjeev Kumar1
Kilo Sage

Hi All,


If you change application Scope global



window.parent.location.href



Code will work. I thing there are some BUG in Fuji.


Now when I change scope global it is working.



Thanks,


Sanjeev Kumar


Hi Sanjeev,



I am not able to reproduce the issue at my end. I've tried window.parent.location.href on custom table(in Scoped application) at client script and it was working fine.


Can you give the steps to reproduce this issue.


Hi,


I am working on Build tag: glide-fuji-12-23-2014__patch6-06-30-2015 .


I believe that ServiceNow starting hiding global variables using an IFFY with the global variable names listed as extra function parameters.   They are trying to isolate custom code to minimize breakage due to conflicting changes to the DOM and other non-published artifacts.   I was rooting around in the page source and noticed the IFFYs - I think they wrap all scoped application scripts, or at least most.


Hadyn
Tera Expert

I just had this same issue. I ended up using a display business rule to set a value on the g_scratchpad which I could then access via a client script.



Display Business Rule Script:


if(gs.action.getGlideURI().get('sysparm_media')=='print'){


      g_scratchpad.isprint = true;


}



onLoad Client Script:


function onLoad() {      


      if(g_scratchpad.isprint){


              dosomething();


      }


}