Calace Sac
Calace Sac

Reputation: 31

SalesForce - How to allow a Custom Object to be edited in visual force page

How do I show an edit button for a custom object in a visual force page and allow the user to edit the custom object?

Upvotes: 0

Views: 1203

Answers (1)

Marcel Meijer
Marcel Meijer

Reputation: 186

in your page create a button:

<apex:commandButton action="{!MyEdit}" value="edit">
     <apex:params value="{!theIdOfTheRecordToEdit}" name="MyId" assignTo=”{!theId}” />
</apex:commandbutton>

in your controller create a global parameter and an action public String theId {get;set;}

public pagereference MyEdit() {
   return(new pagereference('/'+theId+'/e'));
}

The 'magic' is in the '/e' at the end.

Upvotes: 1

Related Questions