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
Gaurav RajGaurav Raj 

Transferring record details page from one visualforce page to another

OnClick of a button i want to fetch all the details in a page named detailpage to be shown in another page named Confirmation. The values should pertain to same id i.e. all the values should be tha same on both the pages.

I'm fetcheng record details on the detailpage from my object Product and same details should be fetched on the Confirmation page . after which i can use the upsert to save this record in a new object named Booking. 

MagulanDuraipandianMagulanDuraipandian

http://infallibletechie.blogspot.in/2012/10/calling-controller-method-using.html

 

Check this site for calling apex method from javascript

 

<apex:outputlink value = "/apex/sample">

  <apex:param name = "id" value = "{!recId}"/>

</apex:outputlink>

 

Apex:(Controller for current page)

String recId {get;set;}

Fetch the record id and assign it to recId;

 


Apex:(Controller for redirected page(Sample Page)

 

public String message = System.CurrentPagereference().getParameters().get('msg');

Fetch the details using record id here.

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

 

SFDC Blog

 

If this post is your solution, kindly mark this as the solution.

 

Gaurav RajGaurav Raj

can this be done without javascript?

earlier i had used the following 

//<apex:commandButton value="BUY NOW" onClick="window.location='Confirmation?id={!Product__c.id}'; return false;" />

but this doesnt seem to be working properly.
help me with any modifications or something new which i can use here.

MagulanDuraipandianMagulanDuraipandian

Sample code:

 

<apex:page controller="sample">
    <!-- Calling Controller Method from Visualforce page -->
   
    <!-- Javascript -->
    <script type="text/javascript">
        function jsfind()
        {
            callfind();
        }
    </script>
   
    <apex:pagemessages />
   
    <apex:form >
   
    <apex:actionFunction name="callfind" action="{!searchAndfind}" reRender="a" />
   
    <apex:pageBlock >
        <apex:pageblockSection >
            <apex:outputLabel >Query:</apex:outputLabel>
            <apex:inputText value="{!qry}"/>       
        </apex:pageblockSection>
       
        <apex:pageBlockButtons >
            <apex:commandButton value="Query" onclick="jsfind()"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
   
    </apex:form>

</apex:page>


Apex Class: 
 
public class sample
{

    public String qry{get;set;}

    public pageReference searchAndfind()
    {
        pageReference pg = new pageReference('http://www.google.com/search?q='+qry);
        pg.setRedirect(true);
        return pg;
    }      
}

 

 

Regards,

 

Magulan D

 

Salesforce.com certified Force.com Developer.

 

 

 

SFDC Blog

 

 

 

If this post is your solution, kindly mark this as the solution.

 

Gaurav RajGaurav Raj

What if the ID needs to be passed automatically?

MagulanDuraipandianMagulanDuraipandian

Use the code like this for <apex:actionFunction>

<apex:actionFunction>

    <apex:param/>

</apex:actionFunction>

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

 

SFDC Blog

 

If this post is your solution, kindly mark this as the solution.