how to get Parameter from URL in Jelly Script

Jiang Yang
Tera Contributor

Hello,

I am trying to get parameter from the URL in Jelly Script

URL - https://xxxxxx.service-now.com/nav_to.do?uri=%2F$pa_dashboard.do%3Fsysparm_dashboard%3De59a38708701011068c6ca280cbb355a%26params_requester%3D3a8965143b1c445052ca655593efc4e6

I have tried the below code

<g:evaluate var="jvar_wbsid">
var value = RP.getParameterValue('params_requester');
value;
</g:evaluate>
<g:ui_reference name="QUERY:active=true" value = "${jvar_wbsid}" id="assigned_to" table="sys_user" />
<span>${jvar_wbsid}</span>

 

Result :

null

 

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

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

17 REPLIES 17

Hi,

Can you explain then how did you confirm sys_id worked fine?

Please share how are you opening that URL and how are you forming the parameters?

are you in scoped app?

Regards
Ankur

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

I'm really sorry for your misunderstanding.
sys_id is also doesn`t worked fine.

Hi,

Please share how are you opening that URL and how are you forming the parameters?

are you in scoped app?

Regards
Ankur

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

I create a UI action on form .

After I click on the UI action, it is redirected to a dashboard page and at the same time, the field values on the form are transferred to the dashboard as URL parameters.

 

UI action script:

var code = current.u_requester;
gs.setRedirect("$pa_dashboard.do?sysparm_dashboard=e59a38708701011068c6ca280cbb355a&params_requester=" + code);

 

dashboard content block script:

<g:evaluate var="jvar_wbsid">
var wbsid = RP.getWindowProperties().params_requester;
wbsid;
</g:evaluate>
<g:ui_reference name="QUERY:active=true" value ="${jvar_wbsid}" id="assigned_to" table="sys_user" />
<span>${jvar_wbsid}</span>

Hi,

seems the URL which is received within the content block is not having that parameter

try to check using this

<g:evaluate var="jvar_wbsid">
var wbsid = gs.action.getGlideURI();

gs.info('url is' + wbsid);
wbsid;
</g:evaluate>

if it shows correctly then use this to get parameter value

gs.action.getGlideURI().getMap().get('URL Parameter Name')

regards
Ankur

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