- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2017 05:47 PM
How does one get the sys_id of the current page that the user is viewing in the service portal?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2017 06:35 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2017 06:05 PM
Hi Scott,
If you want to get sys_id of the current record in widget, you can get it by putting below code at widget's server script field,
$sp.getParameter("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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2017 06:12 PM
This is incorrect as this returns null, because that's assuming you're passing a page sys_id via the url.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2017 06:35 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2017 06:39 PM
That makes sense. However I thought there might of been a method as part of the $sp object to return the page object.