Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to create a variable with the current root path in Workflow Studio

axplains8556
Tera Contributor

Hi all,

I would like to create a "Send email" action in a flow which contains a link to an Order Guide.

 

The problem is that the path is different in a test environment:
("https://test.service-now.com/now/etc...")
and a production environment:
"https://prod.service-now.com/now/etc...").


How can i create a URL in the test environment which can work in the production environment?

A variable or the like containing the "current" base URL.
Just the base URL must be different, the rest of the path is obviously fixed.

 

Thanks in advance

 

1 ACCEPTED SOLUTION

ayushraj7012933
Giga Guru

You don't need to hardcode the instance URL. A better approach is to use the glide.servlet.uri system property, which automatically returns the base URL of the current instance.

For example:

var url = gs.getProperty('glide.servlet.uri') + "now?id=sc_cat_item_guide&sys_id=<ORDER_GUIDE_SYS_ID>";

This way, when the flow is promoted from Test to Production, the URL will automatically point to the correct instance without requiring any changes.

If you're building the URL directly in Flow Designer and don't have access to scripting, check whether your release provides an Instance URL data pill. Otherwise, generating the URL using glide.servlet.uri is the standard and recommended approach.

View solution in original post

1 REPLY 1

ayushraj7012933
Giga Guru

You don't need to hardcode the instance URL. A better approach is to use the glide.servlet.uri system property, which automatically returns the base URL of the current instance.

For example:

var url = gs.getProperty('glide.servlet.uri') + "now?id=sc_cat_item_guide&sys_id=<ORDER_GUIDE_SYS_ID>";

This way, when the flow is promoted from Test to Production, the URL will automatically point to the correct instance without requiring any changes.

If you're building the URL directly in Flow Designer and don't have access to scripting, check whether your release provides an Instance URL data pill. Otherwise, generating the URL using glide.servlet.uri is the standard and recommended approach.