You need to sign in to do that
Don't have an account?
goose
passing custom object via URL parameter
Hi,
I've written a wizard for updating a custom object.
What I cannot see to do is call the wizard with a parameter that - when passed - will set the an object variable within the wizard.
For example. i have a custom object; Flight__c. On a particular flight's detail page, I want to add a button that will call a custom visualforce page with that flight's id passed as a parameter. eg: na6.salesforce.com/apex/testpage?id=00000SA1Q
In that page - testpage - there is a form that will allow some of that record's values to be edited:
and the controller get:
and the rest of the methods are for various 'prev', 'next' and 'save' buttons - together with getters and setters for other objects. I just can't see where the flight can be initially set from the id paramater.
I'm probably missing something obvious - so a pointer would be really appreciated.
Thanks
I've written a wizard for updating a custom object.
What I cannot see to do is call the wizard with a parameter that - when passed - will set the an object variable within the wizard.
For example. i have a custom object; Flight__c. On a particular flight's detail page, I want to add a button that will call a custom visualforce page with that flight's id passed as a parameter. eg: na6.salesforce.com/apex/testpage?id=00000SA1Q
In that page - testpage - there is a form that will allow some of that record's values to be edited:
Code:
<apex:page controller="bookingWizController"> <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 0 of 7"/> <apex:form > <apex:pageBlock title="Define Flight Name" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!step1}" value="Next"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Test set Flight"> <apex:outputField id="flight" value="{!flight.name}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Test pick account"> <apex:inputField id="account" value="{!flight.Flight_Account__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockSection title="Test pick dep airport"> <apex:inputField id="dep_airport" value="{!flight.Flight_departure_airport__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockSection title="Test pick arr airport"> <apex:inputField id="arr_airport" value="{!flight.Flight_arrivals_airport__c}" required="true"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
and the controller get:
Code:
public Flight__c getFlight() { if(flight == null) flight = new Flight__c(); return flight; }
I'm probably missing something obvious - so a pointer would be really appreciated.
Thanks
Your controller can look at the query string parameter ( in it's constructor) and set a property that your page can access within the wizard.
your page could use < apex : param to set values when the buttons are pressed, this is common in a wizard
Try adding this to your controller:
Basically, retrieve id from the query parameters and then select it along with the appropriate fields using SOQL.
Thanks - that will work perfectly.
Much appreciated
Hi, this is probably ridumentary by now, but I have created a custom object and am passing field values from the standard opportunity to the custom object. There is a button on the opportunity page to create the new object. I am able to populate the new fields, but they all must be text-based. Is there a way to pass a lookup field value to a field on a new object via URL but have it preserve the lookup functionality in pass. Here is my URL for the new button below. The LAST field after the ampersand is the Opportunity Account. I want that to preserve as a lookup value in the new record.
https://na7.salesforce.com/a06/e?00NA0000002ld3f={!Opportunity.Id}&00NA0000002lcvS={!Opportunity.Name}&00NA0000002ld4d={!Opportunity.Projected_Go_Live_Date__c}&00NA0000002leO0={!Opportunity.Amount}&CF00NA0000002VTPv_lkid={!Opportunity.AccountId}
Appreciate you help,
Gita
Gita - did you get a response/answer to this question?
Hi Gita or anyone,
Do we have an answer for Gita's question?
Question is regarding passing the lookup value as parameter to the custom object.
For example: Like passing Opportunity and Account into the custom object page where these will be showned as lookup fields. Currently these lookup parameters are lost and not set properly in the custom object screen.
~NK