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

please check any OOB Dynamic content has similar code

regards
Ankur

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

cs5
Tera Contributor

Did you ever figure this out.  I'm trying the same thing and failing the same way.

natecousins
Tera Contributor

It was failing for me too. In my case, I needed the Dashboard Sys id. The url did not contain the sysparm_dashboard parameter, but an "angular.do?" url,  similar to the OP.

 

"angular.do?additionalSysParm=%7b%22sysparm_homepage_filters%22%3a%5b%5d%7d&canvasSysId=eccab4708701011068c6ca280cbb3549&method=getWidgetsContent&selectedItems=%5b%7b%22sysId%22%3a%22619715808747411068c6ca280cbb3580%22%2c%22uuid%22%3a%229b6572c3-00b9-4f03-8bf6-0e6d8dc85065%22%7d%2c%7b%22sysId%22%3a%221a0bd1b787f6011068c6ca280cbb3500%22%2c%22uuid%22%3a%22ed521e19-1403-48ee-8528-6f11f51f3b31%22%7d%2c%7b%22sysId%22%3a%222b2c5f9a8736411068c6ca280cbb35f5%22%2c%22uuid%22%3a%228540d9af-0bfd-4c21-8e1a-d440671b4d6b%22%7d%5d&sysparm_type=canvasProcessor"

 

From another post, someone shared that the following code provides the Dashboard Sys Id "SNC.dashboards.dashboard.dashboardSysId". This works in javascript, but I need to query data before the page loads.

 

I ended up grabbing the canvasSysId parameter from the angular.do? url using the following code "gs.action.getGlideURI().getMap().get('canvasSysId')" in Jelly. With the Canvas Sys Id, I can query the pa_tabs table to get the Tab Sys Id, which allowed me to query the pa_m2m_dashboard_tabs table for the Dashboard Sys Id. Prefer a documented solution, but it works for now.