Passing two parameters in an URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2015 05:27 AM
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2015 12:10 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2016 09:34 AM
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 &. What I used is & than ${AMP}.. Hope this helps.
-james
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2017 02:36 PM
Hi Manasa
Have you got this working? I have the same problem not able to get the second value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2017 08:23 AM
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}&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