RP.getParameterValue is not returning anything
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2020 03:19 AM
Hi,
I've been writing a UI Macro. I am trying to fetch the sysparm_id from the URL. I've used RP.getParameterValue function in Jelly, but the debug shows that this function isn't returning anything.
Here's the code:
<g:evaluate var="jvar_show_encrypt" jelly="true">
var id = "${RP.getParameterValue('sysparm_id')}";
gs.log('Inside Macro' + id); //This just shows Inside Macro
</g:evaluate>
Also, I'm trying to use this in attachment_encrypt UI Macro that is shown inside the attachment popup. Are the URL Parameters available here, because I tried the same code in a different macro that was on a page and it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2020 03:30 AM
Hi Sanjay,
Try with below code,
<g:evaluate var="jvar_show_encrypt" jelly="true">
var id = '${RP.getParameterValue('sysparm_id')}'; //use single inverted commas
gs.log('Inside Macro' + id); //This just shows Inside Macro
</g:evaluate>
please go through below thread,
Fetch values from url in UI Macros
If it helps you in any way mark it as helpful or correct if it solved your problem.
Let me know if you need further assistance.
Hope it helps,
regards,
Kamlesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2020 03:46 AM
Hi Kamlesh,
Thanks for the reply.
I've done as you said but with same result.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 03:34 AM
Hi Sanjay,
Try below code in jelly script,
<g:evaluate var="jvar_show_encrypt" jelly="true">
var id = '${RP.getParameterValue('sysparm_id')}'; //use single inverted commas
gs.log('Inside Macro' + id); //This just shows Inside Macro
</g:evaluate>
<script>
function getParmVal(name){
var url = document.URL.parseQuery();
if(url[name]){
return decodeURI(url[name]);
}
else{
return;
}
}
</script>
If my answer helped you in any way, please then mark it as helpful or correct if it solve your problem.
Let me know if you need further assistance.
Hope it helps,
regards,
Kamlesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2020 06:46 AM
Seems like it might be an issue of Scope. RP.getParameterValue('sysparm_id') is not available within a scoped application. Try one (or both) of the following:
<g:evaluate var="jvar_show_encrypt" jelly="true">
//var id = "${RP.getParameterValue('sysparm_id')}";
var id = RP.getWindowProperties().sysparam_id
gs.log('Inside Macro' + id); //This just shows Inside Macro
</g:evaluate>
//Or try
<g:evaluate var="jvar_show_encrypt" jelly="true">
//var id = "${RP.getParameterValue('sysparm_id')}";
var id = "${sysparm_id}"
gs.log('Inside Macro' + id); //This just shows Inside Macro
</g:evaluate>
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!