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
rohitsfdcrohitsfdc 

How to pass query string from one vf page to another in salesforce sites??

i have a sf site where i calculate a variable. and i want this variable to be displayed in another page in the same salesforce site. how to do that??

 

Pradeep_NavatarPradeep_Navatar

You can pass this variable as query parameter with url, for example :

 

https://abc.com?temp=123

 

and can access in redirected page with help of ApexPages.currentPage().getParameters().get('temp'); method.

 

Hope this helps.

SSRS2SSRS2

I think your requirement is value get from URL and have to be pass value to URL from controller

 

<apex:page >
  <!--get value from url by VF page-->
  <h1>{!$CurrentPage.parameters.paramName}</h1>
</apex:page>

 Simple sample done check whether you met the requirement

 

<!--set as site home page-->
<apex:page controller="TestSite">
  <apex:form >
    <apex:commandLink value="Save" action="{!go}">
      <apex:param name="paramName" value="paramValue"/>
    </apex:commandLink>
  </apex:form>
</apex:page>

========================================
public class TestSite {
    public PageReference go() {
        String paramVal = 
        ApexPages.currentPage().getParameters().get('paramName');//value to be passed 
        PageReference pr = page.testPage;
        pr.getParameters().put('paramName', paramVal);//pass value
        return pr.setredirect(true);
    }
}
========================================

<!--testPage -->
<!--add this page for 'site VF pages'-->
<apex:page>
  <!--get value from url by VF page-->
  <h1>{!$CurrentPage.parameters.paramName}</h1>
</apex:page>

 

 

-Suresh