function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcdev.ax551sfdcdev.ax551 

Issue with query string parameter and CurrentPage.parameters

Hi there,

 

I had a question on query string parameters and the $CurrentPage.parameters variable.

 

I am sending my query string to a VF page as follows:

https://csx.salesforce.com/apex/xxxxx_clone?sfdc.tabName=xxxxxxxx&myurl=http://www.amazon.com?a=aaa&b=bbb&c=ccc 

 

But when I alert the value of the query string parameter myurl, this is what I get:

 

 http://www.amazon.com?a=aaa (the rest of the query string is stripped off)

 

My JS code si as follows:

 

<script type="text/javascript">
     var tempstURLml= "{!$CurrentPage.parameters.myurl}";
    alert("tempstURLml-->> " + myurl);
</script>

 

 

Does anyone know the fix for this issue? 

 

Thanks for your time.

 

gtuerkgtuerk

Use EncodingUtil.urlEncode to encode your query string parameters before building up your url

 

 

EncodingUtil.urlEncode('some string', 'UTF-8');

sfdcdev.ax551sfdcdev.ax551

Hi,

 

Thanks for your response. My understanding is that we need to use an apex class/controller to in order to use the Encoder Utility function and I think we need to get an approach without using one.

 

Let me  please give  you some more details on this. Users would be getting specific links in their emails. The HREF information in those links will be something like this:

 

https://csx.salesforce.com/secur/login_portal.jsp?orgId=xxxxxxxxx&portalId=xxxxxxxxxxxxx&startURL=/apex/firstPage?stURLcustom=http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso&a=one&id_subject=xxxx&defaultlanguage=1

 

When user clicks on the above link, it will try to first login the user to partner portal and then based on the salesforce's startURL parameter, it will redirect them to the VF page named firstPage. It is in this VF page where I need to retrieve the full query string forthe second parameter i.e. stURLcustom.

 

The value that I get for stURLcustom should be th entire string as shown below:

http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso&a=one&id_subject=xxxx&defaultlanguage=1

 

I do not have control on the HREF values behind the custim links as they are send by other systems outside of salesforce.

 

Right now the issue is that when I access the link, I go to the PRM login page and once I enter my login and password, it takes me to the visualforce page, but the document URL is displayed as follows:

 

https://csx.salesforce.com/secur/login_portal.jsp?orgId=xxxxxxxxx&portalId=xxxxxxxxxxxxx&startURL=/apex/firstPage?stURLcustom=http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso

 

instead of:

 

https://csx.salesforce.com/secur/login_portal.jsp?orgId=xxxxxxxxx&portalId=xxxxxxxxxxxxx&startURL=/apex/firstPage?stURLcustom=http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso&a=one&id_subject=xxxx&defaultlanguage=1

 

Any thoughts?

 

Thanks for your time.