- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 09:41 PM
I Want to fetch the the sys_id from below URL and Set that value in Employee_id Field Which is reference Field what are the best possible ways to do that?
I want to make this use case dynamic. The sys_id is of emplyee name.
URL= https://dev309459.service-now.com/sp?id=sc_cat_item&sys_id=0962deffc38a2610b0de7f65e40131f5
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 10:42 PM
You can verify sys_id from link using URL class,
verify with the below code in client callable script include:
var url = new URL(window.location.href);
var sysId = url.searchParams.get('sys_id');
if (sysId) {
return sysId;
}
and use GlideAjax in your on load client to set sysId for employee_id with in Onload client script,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 09:54 PM
Hi @Prithvirajk
Are you trying to set the employee name using the information of the currently logged-in user? I believe the sys_id in the URL mentioned above is linked to the catalog item, not the user table.
Please share more information on your requirement.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 10:28 PM
you are not including any user sysId in URL.
Then how can you get it and set in Variable?
If you are redirecting to this catalog item from some UI action etc then it makes sense to include user sysId in URL parameter and then you can use onLoad catalog client script and get the sysId and set it
For that check this
3 Ways to Populate Values in ServiceNow via the URL
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 03:59 AM
Thank you for marking my response as helpful.
As per new community feature you can mark multiple responses as correct.
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 10:42 PM
You can verify sys_id from link using URL class,
verify with the below code in client callable script include:
var url = new URL(window.location.href);
var sysId = url.searchParams.get('sys_id');
if (sysId) {
return sysId;
}
and use GlideAjax in your on load client to set sysId for employee_id with in Onload client script,