Is there a way to use currentinstance to redirect a user instead of a hardcoded hyperlink?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 04:57 AM
Hello, i have a button that you press to log in and it takes you to the login page. Currently i just have it in the html body like so :
<center style="margin-top:15px;">${sh_login_register}/<a class="large-link" href="https://dev.service-now.com/portal1/user_registration_request.do?sys_id=-1&sysparm_view=ess&sysparm_origin=portal1">${sh_loginpage_registernewuser}</a></center>
Is there a way where i dont need to hardcode in the link and just have its dynamic after wich instance your in (prod, test, dev)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:03 AM
HI @asd22
Instead of using the URL as hardcoded, you can use the parameters written after the "/"
For example:
dev11111.service-now.com/id=page_name&sys_id=1234567890123...
Use
/id=page_name&sys_id=1234567890123...
This will make your URL dynamic.
Thanks
dgarad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:07 AM - edited ‎05-28-2024 05:11 AM
Hi @asd22 ,
Use this OOTB system property to get instance name.
gs.getProperty('glide.servlet.uri')
or
gs.getProperty('instance_name')
Your modified code:
<center style="margin-top:15px;">${sh_login_register}/<a class="large-link" href=" '+gs.getProperty('glide.servlet.uri')+' "portal1/user_registration_request.do?sys_id=-1&sysparm_view=ess&sysparm_origin=portal1">${sh_loginpage_registernewuser}</a></center>
If my answer helped you in any way, please mark it as helpful or correct.