- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 06:37 AM
Hi
I have a requirement where I need to build a dynamic URL, need to use already present ('glide.servlet.uri')- system property to build the URL then append catalog item sysid, so that it will open the form according to the environment. Any suggestions how this could be implemented ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 06:50 AM
in notification?
if yes then simply use the relative URL in notification
if you are planning to use email script then it should be like this, please enhance it further
var baseUrl = gs.getProperty('glide.servlet.uri');
// Get the catalog item sys_id (replace 'your_catalog_item_sys_id' with the actual sys_id)
var catalogItemSysId = 'your_catalog_item_sys_id';
// Build the dynamic URL for native
var dynamicUrl = baseUrl + 'com.glideapp.servicecatalog_cat_item_view.do?sys_id=' + catalogItemSysId;
// Build it for portal
var urlPortal = baseUrl + 'esc?id=sc_cat_item&sys_id=' + catalogItemSysId
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
04-03-2025 06:42 AM
But what is use case here?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 06:49 AM
@Dr Atul G- LNG I have a catalog item in prod already created, I need to create a button from UI action that will redirect to that catalog item but based on the environment I am in for ex: If I am logged into dev instance it should take me to dev, if I am in test-it should take me to test and so on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 07:08 AM
if the UI action is server side then do this
var baseUrl = gs.getProperty('glide.servlet.uri');
// Get the catalog item sys_id (replace 'your_catalog_item_sys_id' with the actual sys_id)
var catalogItemSysId = 'your_catalog_item_sys_id';
// Build the dynamic URL for native
var dynamicUrl = baseUrl + 'com.glideapp.servicecatalog_cat_item_view.do?sys_id=' + catalogItemSysId;
// Build it for portal
var urlPortal = baseUrl + 'esc?id=sc_cat_item&sys_id=' + catalogItemSysId;
action.setRedirectURL(urlPortal);
if it's client side then you can simply use relative URL using /
Something like this
var catalogItemSysId = 'your_catalog_item_sys_id';
// Build the dynamic URL for native
var dynamicUrl = '/com.glideapp.servicecatalog_cat_item_view.do?sys_id=' + catalogItemSysId;
// Build it for portal
var urlPortal = '/esc?id=sc_cat_item&sys_id=' + catalogItemSysId;
g_navigation.open(urlPortal);
Please share your complete UI action script and screenshots
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
04-03-2025 06:50 AM
in notification?
if yes then simply use the relative URL in notification
if you are planning to use email script then it should be like this, please enhance it further
var baseUrl = gs.getProperty('glide.servlet.uri');
// Get the catalog item sys_id (replace 'your_catalog_item_sys_id' with the actual sys_id)
var catalogItemSysId = 'your_catalog_item_sys_id';
// Build the dynamic URL for native
var dynamicUrl = baseUrl + 'com.glideapp.servicecatalog_cat_item_view.do?sys_id=' + catalogItemSysId;
// Build it for portal
var urlPortal = baseUrl + 'esc?id=sc_cat_item&sys_id=' + catalogItemSysId
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