RP.getParameterValue service portal

amkatulak
Giga Expert

I have a variable in a catalog item that I would like to use in Service Portal.   This variable has a default value that would be passed as a parameter from another task.

Typically in the past, I have used javascript:RP.getParameterValue('sysparm_parent');

My URL would then have &sysparm_parent=${sys_id} appended to it.   This doesn't appear to be working in Service Portal.   Does anyone know if this is not supported?   If not, are there other ways we can pass values into forms in the Service Portal?

Thanks

1 ACCEPTED SOLUTION

I think those methods will not work.


you can do with one client script to set the value. In that use the method,


var URL = this.location.href; // it will get the URL of the catalog item. It will work in both service portal and regular view.


from that you can try get the value of sysparm_parent.


View solution in original post

9 REPLIES 9

BALAJI40
Mega Sage

Is it append from the catalog item URL?


also did you know that URL's of portal and regular view are different. On portal catalog item url is it contains the sysparm_parent value?


Portal URL with Parameter = https://mycompany.service-now.com/mme?id=sc_cat_item&sys_id=d3fe38c513c4fe00cb92b7a66144b07f&sysparm_parent=f0a783cb1357e200cb92b7a66144b0f5   --> Doesn't work





Normal URL with Parameter = https://mycompany.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=d3fe38...sysparm_parent=f0a783cb1357e200cb92b7a66144b0f5 -->Works



The default value for my variable is javascript:RP.getParameterValue('sysparm_parent')




So based on that, you can get the parameter "sysparm_parent" in both the portal and regular view, is it correct?


sysparm_parent=f0a783cb1357e200cb92b7a66144b0f5 --> this parameter


Yes, my URL is correct.   What I'm trying to figure out is if I can use the RP object to retrieve the parameter value of 'sysparm_parent' from the URL.   In Service Portal my variable is not populated by default using the url, but in regular service catalog it is.


Thanks