function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nani@408Nani@408 

Automatic update The phone Field on Contact Object

Hai ,

 

Req:Initially Phone Field is Empty on Contact Object.when i saving some record with some  Name ,.

i want to save that record  automatically with some phone number  also

 

This is my code:

 

trigger automatic on Contact (before update)
{
List<String> ContactNames =new List<String>{};
if(trigger.isbefore && trigger.isupdate){
for(contact c:Trigger.New)
{
c.Phone='9999999999';

}
}
}

 

 

 

i got it Through Before update..But my requirement is  Through After Update..help me

 

 

Thanks in Advance

 

 

alibzafaralibzafar

In after update your trigger will go in infinite loop, beacuse its setting off the trigger again. See the link below to get it work in after update. 

 

http://www.salesforce.com/docs/developer/cookbook/Content/apex_controlling_recursive_triggers.htm

 

Thanks