2

Write a Trigger to auto populate the following Account fields when the record type is Internal to Facebook.

Website – http://www.facebook.com Billing Address Details --XYZZ Park City --Mumbai State –Maharashtra Country --India Fax --223120 Phone --2230175

Error handling should be done. Error can be logged to Custom object with proper error description and record Id.

  • Hi Soura welcome to Salesforce StackExchange. This site is Q&A site which helps the questioner to get answers in specific problems. To write trigger for you, you need to contact a developer or consultant. Please try something with the help of documents for trigger and post questions if you stuck at somewhere while implementing those. – Vigneshwaran G Jul 16 '15 at 9:00
1

//Trigger for account

Trigger on Account(before insert)
{ 
    RecordType recordType = [ SELECT Id,sobjecttype from RecordType where sobjecttype ='Account' AND NAME ='Facebook' limit 1];
    if(recordType != null )
    {
        for(Account account : Trigger.New){     
            if(account.RecordTypeId == recordType.Id)
            {
                account.Website ='http://www.facebook.com';
                account.BillingStreet = 'Park City';
                account.BillingCity ='Mumbai';
                account.BillingState 'Maharashtra';
                account.BillingCountry = 'India'
                account.Fax='223120';
                account.Phone = '2230175'                   
            }       
        }
   }
}
  • showing an error " Error: Compile Error: unexpected token: 'on' at line 1 column 8 " – Lenka Jul 21 '15 at 6:37

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.