Dynamic URL according to environment

nupur_goswami
Tera Contributor

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 ?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@nupur_goswami 

in notification?

if yes then simply use the relative URL in notification

AnkurBawiskar_1-1743688180370.png

 

AnkurBawiskar_0-1743688155703.png

 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@nupur_goswami 

Would you mind closing your earlier questions by marking appropriate response as correct?

Members have invested their time and efforts in helping you.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader