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
boihueboihue 

How to access to Salesforce object in Edit mode from Visualforce Page?

Hi Experts,
I would like to code for a new button in Visualforce Page that will direct me to an Opportunity (in Edit mode) with some fields automatically filled up using the information passing as parameters from my calling Visualforce Page. Please help!
Best regards,
Boi Hue
 
steve_andersensteve_andersen
You can do a URL hack and just redirect to your edit URL. Your URL can look like this:

/{!opportunity.id}/e?fieldname=fieldvalue&nextfieldname=nextfieldvalue

you'll have to get the right merge field for the Id you care about, and then use Firefox's Page Info Tool to find the form field names.

Look in the VF documentation how to do a redirect to a page reference and you're there.

Steve
boihueboihue
Thanks Steve for your quick response!
crop1645crop1645

Steve:

 

How does this work when developing through a sandbox->prod deployment loop?  The values of fieldname and nextfieldname will be different between sandbox and prod for the same logical field.

 

I looked in APEX Describe methods but there doesn't appear to be any way to dynamically generate the field name from the metadata.

 

Thanks

 

Eric