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
Nagma KhanNagma Khan 

how to read the url visualfroce page to another visualfroce page

hi

Please any one support me
how to slove ?
I have a url https://c.ap5.visual.force.com/apex/OutBoundService?id=a047F0000011ei5QAA          and i want to read another visualfroce page that
particualr record id its dynamically on the second page please support me


Thanks
Nagma Khan
pradeep kumar yadavpradeep kumar yadav
You Can put this record Id to Url of that page using PageReference....
 
PageReference pageRef = Page.VF_Page_Name;
            
pageRef.getParameters().put('id','a047F0000011ei5QAA');

And redirect pageReference to that page...
 
pageRef.setRedirect(true);

return pageRef;

On another page in controller, you can get that record ID using ApexPages...
 
ID recordID = Apexpages.currentPage().getParameters().get('id');

 
Nagma KhanNagma Khan
hi Pradeep


can you give me with apex because i am new so please help me ?
pradeep kumar yadavpradeep kumar yadav
1st Visualforce page
 
<apex:page controller="firstPageController">
   <apex:commandButton value="Send" action="{!sendID}"/>
</apex:page>

1st Visualforce Page Controller

public class firstPageController {
    
    public ID recordID;

    public pageReference sendID() {
        
        recordID = 'a047F0000011ei5QAA';
        
        PageReference pageRef = Page.secondVFpage;
        
        pageRef.getParameters().put('id',recordID);
        
        pageRef.setRedirect(true);
        
        return pageRef;
    }
}

2nd Visualforce Page

<apex:page controller="secondPageController">
    <apex:outputText value="{!recordID}"/>
</apex:page>

2nd Visualforce Page Controller
 
public class secondPageController {
    
    public ID recordID{get; set;}

    public secondPageController() {
        
        recordID = Apexpages.currentPage().getParameters().get('id');
    }
}