Add Database Trigger to Populate Account.Name

  1. In Salesforce launch the Developer Console (in the Setup symbol in the top right).
  2. Select File>New>Apex Trigger.
  3. Enter Name as AccountName.
  4. Enter sObject as Account
  5. Enter as the trigger
    trigger AccountName on Account (before insert, before update) {
         for (Account a: Trigger.new){
               a.Name = a.BillingFirstName__c+' '+a.BillingLastName__c; 
         }
    }
  6. Launch the Developer Console (in the Setup symbol in the top right).
  7. Select File>New>VisualForce Page.
  8. Enter Name as BillMaxAccount.
  9. Enter for the page
    <apex:page standardController="Account" 
     action="{!URLFOR($Action.Account.New,null,[acc2='<ignore>'],true)}">
    </apex:page>
  10. Click Setup>Object Manager.
  11. Select Account.
  12. Select Buttons, Links, and Actions.
  13. Find New and choose Edit action.
  14. Click on the radio button for Visualforce page and Save.
  15. Select the custom page BillMaxAccount.
  16. Click SAVE.