Display the current URL of my servicenow instance from an ui page

caroleb_atrice
Tera Contributor

Hello everyone,

I want to display the current URL of my Servicenow's instance form an UI Page using javascript and jelly. Can I have some script example to do this ?

Exist another way to display this current URL in a alert dialog ?

 

Thanks in advance,

Carole

 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

It could be as simple as this:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
	alert(window.location.href);
	</script>
</j:jelly>

What is the requirement here? Do you want to use that URL somewhere else on the UI page?

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

HI @carolebéatrice ,

You can create a UI action.

Use the following:

  var gURL = new GlideURL();
  gURL.setFromCurrent();

  // you can get params by doing the following
  var param = gURL.getParam("parameter_in_url");

Refer : https://community.servicenow.com/community?id=community_question&sys_id=e61dec0adb600c10190dfb2439961959

 

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Community Alums
Not applicable

It could be as simple as this:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
	alert(window.location.href);
	</script>
</j:jelly>

What is the requirement here? Do you want to use that URL somewhere else on the UI page?

I want to display that URL from a catalog custom variable.