You need to sign in to do that
Don't have an account?
Roger Pavelle
Issue passing ID from one custom form to another.
I have two VisualForce pages that I've created that deal with a custom object. The first page has several search criteria. The second page is called from the first and is designed to show the details of a selected record.
How do I pass the ID from the Search page to the Detail page? The code snippit I'm using is:
<apex:outputLink value="{! URLFOR('/apex/boleteDetailView', bol.Id) }">
View
</apex:outputLink>
This opens the detail page fine, but I don't see any evidence that the ID has been passed.
I've also tried creating a function in the controller that would hold the ID (so I could get around this problem), but that doesn't seem to work either (probably due to a misunderstanding of the way the apex:outputLink tag works).
<apex:outputLink value="{! URLFOR('/apex/boleteDetailView', bol.Id) }">
<apex:actionSupport action="{!setSelectedID}" event="onclick">
<apex:param name="ID" value="{!bol.ID}"/>
</apex:actionSupport>
View
</apex:outputLink>
Also, once I am on the detail page, how do I retrieve the details for the selected record? Is there a way to retrieve the custom object's fields/values directly (like you can with the standard controller) or will I also need to create a function in the custom controller to get the detail records?
How do I pass the ID from the Search page to the Detail page? The code snippit I'm using is:
<apex:outputLink value="{! URLFOR('/apex/boleteDetailView', bol.Id) }">
View
</apex:outputLink>
This opens the detail page fine, but I don't see any evidence that the ID has been passed.
I've also tried creating a function in the controller that would hold the ID (so I could get around this problem), but that doesn't seem to work either (probably due to a misunderstanding of the way the apex:outputLink tag works).
<apex:outputLink value="{! URLFOR('/apex/boleteDetailView', bol.Id) }">
<apex:actionSupport action="{!setSelectedID}" event="onclick">
<apex:param name="ID" value="{!bol.ID}"/>
</apex:actionSupport>
View
</apex:outputLink>
Also, once I am on the detail page, how do I retrieve the details for the selected record? Is there a way to retrieve the custom object's fields/values directly (like you can with the standard controller) or will I also need to create a function in the custom controller to get the detail records?
Then use below code. To get Id in boleteDetailView controller.
Please let us know if this will help you.
Thanks,
Amit Chaudhary
All Answers
Please see the sample code below
please see the link below
https://developer.salesforce.com/forums/?id=906F0000000An8iIAC
Best Regards
Naga Kiran
You need to implement this scenario using Visualforce wizard.
Refer this link: http://developer.force.com/cookbook/recipe/creating-a-wizard-with-visualforce-pages
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_wizard.htm
If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.
So, since the ID is being passed to the detail page, is there a way to retrieve the value from there and then pass it to the controller or access it from the controller? I've tried using ApexPages.currentPage().getParameters().get('Id') in the controller, but it is not retrieving anything (i.e. value is null).
Then use below code. To get Id in boleteDetailView controller.
Please let us know if this will help you.
Thanks,
Amit Chaudhary