0

Now I have a table in a VF that shows a bunch of leads. In this table I put the view button, when the users click the button they can view the record detail page, but how can I put near the view button the edit button? here my code:

<apex:outputPanel id="output">
    <apex:pageBlock title="Possibili Lead" id="Possibili" rendered="{!IF(Lead.Company =null , false, true)}" >
    <apex:pageBlockSection title="Lead" id="possibilita" collapsible="false" columns="1" >
        <apex:pageblockTable value="{!PossibiliLead}" var="pl">
        <apex:column headerValue="Action">
        <apex:outputLink value="/{!pl.Id}">View</apex:outputLink>
        </apex:column>
        <apex:column value="{!pl.Id}"/>
        <apex:column value="{!pl.Company}"/>
        <apex:column value="{!pl.LastName}"/> 
        <apex:column value="{!pl.Email}"/>
        <apex:column value="{!pl.Phone}"/>
        <apex:column value="{!pl.Website}"/>                             
        </apex:pageblockTable> 

With the edit button the user can open the edit page of the that lead and the fields prefilled with the actual values

1

Use the below code for opening the current record in standard edit mode:

<apex:outputLink value="{!URLFOR($Action.Lead.Edit, pl.Id, null, true)}">Edit</apex:outputLink>

Source: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_functions.htm

0

From your controller fill all the attributes and redirect the page like this

PageReference requestPage = new ApexPages.StandardController(new Lead(Id=<Lead Id>)).edit();
    return requestPage; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.