How to pass current logged user's user ID along with a hyperlink from Dynamic content block

Krishna137
Tera Contributor

We have added a new dynamic content box in the end user portal of our SNOW instance. Once the button is clicked,  a link should be opened in a new window. As per the requirement, they want SNOW to pass the current logged in user's ID also along with the link. I am not aware of jelly script, so can anyone help to do this ? 

We have created a dynamic content for the button with a text like "Click" 

Once the user clicks on "Click", the provided link is supposed to open and the link should contain the current user'd log in ID as well. PLease help how can we include a script here to get the current user's name/ID and how can we pass that variable in the link.

 

The link is opening as expected in new window, but not sure how to pass the user ID. The user ID should be passed like - https://abc.com/?un={USERID}. PLease help how can we include a script here to get the current user's name/ID and how can we pass that variable in the link.

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a href="https://abc.com/?un={USERID}" target="_blank">
<div class="cms_menu_section_blocks">
<h2>Click
</h2>
<img src="ICON.pngx" />
</div>
</a>
</j:jelly>

1 ACCEPTED SOLUTION

rahulpandey
Kilo Sage

Hi,

You can try like below

<a href="https://abc.com/?un=${gs.getUserName()}" target="_blank">

View solution in original post

5 REPLIES 5

Omkar Mone
Mega Sage

Hi 

Try once with gs.getUserID().

rahulpandey
Kilo Sage

Hi,

You can try like below

<a href="https://abc.com/?un=${gs.getUserName()}" target="_blank">

Krishna137
Tera Contributor

Hi,

 

Can you help me where to include the script and how ? And also how to use the value in the URL?

 

Thanks,

Krishna

Hi,

You don't have to create any script.

below is the full code of whole page.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a href="https://abc.com/?un=${gs.getUserName()}" target="_blank">
<div class="cms_menu_section_blocks">
<h2>Click
</h2>
<img src="ICON.pngx" />
</div>
</a>
</j:jelly>