RP.getParameterValue is not returning anything

Sanjay14
Kilo Explorer

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.

6 REPLIES 6

Kamlesh Pimple
Mega Expert

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.

Hi Kamlesh,

Thanks for the reply.

I've done as you said but with same result.

Thanks

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.

Michael Jones -
Giga Sage

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!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!