Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get instance url dynamically in UI Builder?

shalani1
Tera Contributor

Hi all,

Can anyone please help me on how to get instance url dynamically in UI Builder?

Eg: (https://devxxxxx.service-now.com)-->need to display in text link component in UI Builder

In Text Link component-> its asks for the link -->"https://devxxxxx.service-now.com"+i'll append the page id(eg: /sp)

 

Regards,

Shalani Rajendran

3 REPLIES 3

Mehul6
Tera Contributor

change the link to a script and then use the function 

function evaluateProperty({api, helpers}) {
 var instanceURL = gs.getProperty('glide.servlet.uri');
	return  instanceURL ;
}

shalani1
Tera Contributor

Thank you for the response. Yeah thats the way we use script for instance url....i asked in ui builder how to use it?

Tristan Elmore
Tera Expert

I realize this is an older post, but I came across this same requirement. I found the easiest way to do this is to use a 'Lookup system properties' data resource that you can pull 'glide.servlet.uri', and then you can build out a link using a client script and/or client state parameter.image.png