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
I am new to Salesforce.comI am new to Salesforce.com 

Visualforce ID

How to pass Visualforce ID, one Visualforce page to another Visualforce page

 

 

Thanks 

SFDC_Learner

Best Answer chosen by Admin (Salesforce Developers) 
kiranmutturukiranmutturu
some thing like this


source


<apex:page controller="SFDCVariables_01">
<a href="/apex/SFDCVariables_02?MyVariable=25">Click Me</a>
<apex:form >
<apex:pageblock >
<apex:pageblockButtons >
<apex:commandButton value="click Me 2" action="{!Transfer}" />
</apex:pageblockButtons>
<apex:pageBlockSection >
<apex:inputText value="{!Value2Pass}" />
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>

public class SFDCVariables_01 {
public String Value2Pass { get; set; }
public PageReference Transfer() {
PageReference newPAge = page.SFDCVariables02;
newPage.getParameters().put('MyVariable', Value2Pass);
return newPage;
}
}


DESTINATION

<apex:page controller="SFDCVariables02">
<apex:form >
<apex:inputText value="{!Var01}" />
</apex:form>
</apex:page>

public class SFDCVariables02 {
public String Var01 { get; set; }
public SFDCVariables02() {
Var01 = Apexpages.currentPage().getParameters().get('MyVariable');
}
}

All Answers

kiranmutturukiranmutturu
some thing like this


source


<apex:page controller="SFDCVariables_01">
<a href="/apex/SFDCVariables_02?MyVariable=25">Click Me</a>
<apex:form >
<apex:pageblock >
<apex:pageblockButtons >
<apex:commandButton value="click Me 2" action="{!Transfer}" />
</apex:pageblockButtons>
<apex:pageBlockSection >
<apex:inputText value="{!Value2Pass}" />
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>

public class SFDCVariables_01 {
public String Value2Pass { get; set; }
public PageReference Transfer() {
PageReference newPAge = page.SFDCVariables02;
newPage.getParameters().put('MyVariable', Value2Pass);
return newPage;
}
}


DESTINATION

<apex:page controller="SFDCVariables02">
<apex:form >
<apex:inputText value="{!Var01}" />
</apex:form>
</apex:page>

public class SFDCVariables02 {
public String Var01 { get; set; }
public SFDCVariables02() {
Var01 = Apexpages.currentPage().getParameters().get('MyVariable');
}
}
This was selected as the best answer
I am new to Salesforce.comI am new to Salesforce.com

Thanku Kiran

 

 

Thanks,

SFDC Learner