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.

1
  • 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. Jul 16, 2015 at 9:00

1 Answer 1

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'                   
            }       
        }
   }
}
1
  • showing an error " Error: Compile Error: unexpected token: 'on' at line 1 column 8 "
    – Lenka
    Jul 21, 2015 at 6:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .