how to get Parameter from URL in Jelly Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 02:08 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 02:48 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 03:23 AM
I'm really sorry for your misunderstanding.
sys_id is also doesn`t worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 05:45 AM
Hi,
Please share how are you opening that URL and how are you forming the parameters?
are you in scoped app?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 05:15 PM
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¶ms_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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:07 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader