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

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.


Thanks, I was able to get the value I needed using this.location.href on an onLoad script.


welcome Adam. Happy that your issue was resolved


Hi,

After retrieving the URL with the parameter, how do you pull the value of the parameter.?

 

I have a URL that contain 2 parameters 

https://INSTANCE.service-now.com/sp?id=sc_cat_item&sys_id=969afe0edbc68c5077b67abe3b9619a2&sysparm_subject=VALUE1&sysparm_description=VALUE2

i need to pull the values of both sysparm_subject and sysparm_description.

Do you know what will be the best way to get it?

 

Thanks!

Abhinay Erra
Giga Sage

As far as I know, RP object will work on CMS but not on service portal. As balaji mentioned, you need to write some client side js for this. See the following link on how to parse url on client side


Parse URL Parameters in a Client Script - ServiceNow Guru