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.

Jelly Script get Parameter from URL

rad2
Mega Sage

Hello,

I am trying to get parameter from the URL in UI pages.

URL - https://xxxxxx.service-now.com/incident.do?sys_id=-1&sys_is_list=true&sys_is_related_list=true&sys_target=incident

I have tried the below code

<g:evaluate var="jvar_sys">
    var sysparm_id = RP.getParameterValue("sys_target") + "";
    sysparm_id;
</g:evaluate>


<span>${jvar_sys}</span>

 

This works when i try to get sys_id but returns blank when used for sys_target

Is there any way to get it work for other parameters?

 

1 ACCEPTED SOLUTION

Hi,

then this should work fine

<g:evaluate var="jvar_sys" jelly="true" object="true">
    var sysparm_id = gs.action.getGlideURI().getMap().get('sys_target');
    sysparm_id;
</g:evaluate>

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

15 REPLIES 15

Hi,

then this should work fine

<g:evaluate var="jvar_sys" jelly="true" object="true">
    var sysparm_id = gs.action.getGlideURI().getMap().get('sys_target');
    sysparm_id;
</g:evaluate>

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

just checked. doesnt seem to work

Hi,

the above worked well for me

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

i tried the following code. do i need to make any more changes?

<?xml version="1.0" encoding="UTF-8"?>
<j:jelly trim="false" xmlns:g="glide" xmlns:g2="null" xmlns:j="jelly:core"
	xmlns:j2="null">
	<g:evaluate var="jvar_sys" jelly="true" object="true">
		var sysparm_id = gs.action.getGlideURI().getMap().get('sys_id');
		sysparm_id;
	</g:evaluate>
	<g:evaluate var="jvar_sys1" jelly="true" object="true">
		var sysparm_id1 = '$[sys_id]';
		sysparm_id1;
	</g:evaluate>
	<span>${jvar_sys}</span>
	<span>${jvar_sys1}</span>
</j:jelly>

it works! thank you !