Get current page in service portal

scottl
Kilo Sage

How does one get the sys_id of the current page that the user is viewing in the service portal?

1 ACCEPTED SOLUTION

Hi Scott,



My bad. I thought you were trying to retrieve sys_id from the URL.


You can try below code to get the sys_id of current page,



var page_id = $sp.getParameter('id');


var gr = new GlideRecord('sp_page');


gr.get('id',page_id);


var page_sys_id = gr.sys_id;



Hope this helps.


Do not feel shy to mark correct or helpful answer if it helps or is correct.



Best Regards,


Nitesh Asthana


View solution in original post

13 REPLIES 13

How could I get this information from a global business rule? I want something to run only if the user isn't on a certain record producer within the service portal. I can't find the proper method. This isn't returning everything from the user logged in: gs.action.getGlideURI().getMap().toString();


Hi Blair,



Any specific reason for using Global BR to achieve this?


An alternative could be, create a custom widget and write your logic in the server side script field of the widget. Once created, add that widget to the page which you are using to display catalog items (default page is sc_cat_item). Whenever this page will load that widget script will be executed.



Let me know if it works for you.


Hi,



I need similar functionality. I need to display the current page the user is on into the widget. How to achieve that?



Thanks


Hi Blair,



You can access record producer or catalog item sys_id using $sp.getParameter() API.


Isnt' that working for you or you have some different requirement which I am missing here


Deepak - I was able to get help from HI on this. Here is the answer for getting the current page: How can I get the page a user is on in the Service Portal?