get Sys_ID from Service portal URL

yogeshpoyyara
Mega Expert

I am trying to get the Sys_Id from the URL and then fetch the related records from a table.

I tried, data.sys_id = $sp.getParameter("sys_id"); in the server script ; but it doesn't fetch the sys_id from the URL.

Please assist.

Regards,

Yogesh PH

1 ACCEPTED SOLUTION

Yogesh,



You want to use addQuery, as opposed to addEncodedQuery when looking up just the sys_id.



If you log ' $sp.getParameter("sys_id");', what does it return?




Thanks.


View solution in original post

10 REPLIES 10

chiragb   chiragbagdai



I have kind of similar issue where i want read query string value from portal url and pass the value to my widget as filter , can you check below post?



service portal widget how to read query string value and pass it to filter?



query string value will be passed via portal page



https://myinstance.com/my_sp/newsp/?state=3 ( i want to pass this value to my widget filter)