Activity Forums Salesforce® Discussions how we edit the description of account selected account from a Salesforce list? Reply To: how we edit the description of account selected account from a Salesforce list?

  • shariq

    Member
    August 17, 2017 at 9:56 am

    Hi Shubham,

    Apex Code:-

    public class EditDescription

    {

    List<Account> accList{get;set;}

    public EditDescription()

    {

    accList = [SELECT Name, Description FROM Account LIMIT 10];

    }

    public void editAccount()

    {

    update accList;

    }

    }

    Apex Page:-

    <apex:page controller="EditDescription" sidebar="false" >

    <apex:form>

    <apex:pageBlock >
    <apex:pageBlockButtons >
    <apex:commandButton action="{!editAccount}" value="Add New Account" rerender="pageId"/>

    </apex:pageBlockButtons>

    <apex:pageBlockTable var="customAccount" value="{!accList}" id="pageId">
    <apex:column ><h1>
    Account Name
    </h1> <apex:inputfield value="{!customAccount.Description}" /></apex:column>

    </apex:pageBlockTable>

    </apex:form>

    </apex:page>