Get URL with catalog client script

bonsai
Mega Sage

I want to get the browser URL in a catalog client script.
However, there is no API available, and I can't get it even with "window.location.href".
What should I do?
My goal is to get the parameters set in the URL.

When a widget on another page is executed, it will transition to the record producer page, and I want to get the parameters from the URL and set them as the initial values ​​for the record producer.

I also asked about this in the following article.

 

https://www.servicenow.com/community/sysadmin-forum/can-i-implement-record-copying-functionality-in-...

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

this will work in portal

var url = top.location.href;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

this will work in portal

var url = top.location.href;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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