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.

Passing two parameters in an URL

abcxyz
Kilo Explorer

Hello,

I need to pass two dynamic parameters in an URL and need to retrieve the parameters in the next page.

I have written a script in the dynamic content block and passing the parameters as below.

<a href="https://sssdev.service-now.com/sdsds/Sub_category_page.do?sysparm_my_sysid=${gr.sys_id}${AMP}sysparm_my_sysid1=${gr.catalogsys_id}"> View All</a>.

I need to retrieve the parameters sysparm_my_sysid and sysparm_my_sysid1.

I can retrieve the first parameter using RP.getParameterValue() as below.

<g:evaluate var="jvar_rel1" jelly="true" object="true">

  var rel1 = new GlideRecord('sc_category');

  rel1.addQuery('active',true);

  rel1.addQuery('sys_id', jelly.RP.getParameterValue('sysparm_my_sysid'));

  rel1.query();

  rel1;

</g:evaluate>

But Cannot retrieve the second parameter.

I was suggested to use RP.getParameters();

Can someone guide me how can I use RP.getParameters(); or any other method to achieve this.

Thank you in advance,

8 REPLIES 8

Manjul Katare
ServiceNow Employee
ServiceNow Employee

Thats right Manasa!



Do I have to save parms["req_type"] and parms["type_group"] in any variables? (Yes)


And in the code   I will be replacing   jelly.RP.getParameterValue('sysparm_my_sysid') with jelly.parms["req_type"] right? (Right)



Hope it helps, If you find this post useful or it resolved your issue please mark it accordingly.


-Manjul


jameswang
Kilo Expert

Hi, i believe you already have this worked out.  


But just fyi, I have similar application and retrieved two parameters with RP.getParameterValue() successfully.


The only difference between yours and mine is the &AMP.   What I used is &amp; than ${AMP}..   Hope this helps.



-james


Hi Manasa



Have you got this working? I have the same problem not able to get the second value.


Sam,


I am using two parameters like below


<j:set var="jvar_sc_category_selected" value="${RP.getParameterValue('sysparm_sc_category')}" />


<j:set var="jvar_sc_item_selected" value="${RP.getParameterValue('sysparm_sc_item')}" />



and my url is like below


<a href="/xxxx.do?sysparm_sc_category=${sc_catalog_category}&amp;sysparm_sc_item=${sc_catalog_item}">



Hope it helps.



BTW, if your system is Helsinki, i would highly recommend you use service portal, not only because it's the trend but also it's way easy and powerful to build.   Good luck with your app.



-james