+ Start a Discussion
kaustubh chandratrekaustubh chandratre 

whenever phone field updated in account then the name field should also get updated with name and phone number in account

PriyaPriya (Salesforce Developers) 

Hey Kautubh,

You have to write the Trigger on Account.

If you provide me with more detail, i can help you with the code. 


Priya Ranjan

Rama Gaikwad 5Rama Gaikwad 5
Hi Kaustubh,

You can do it by the trigger.
Please, refer to the trigger code for your reference. Hope it will help you.
trigger updateAccountDetails on Account (before update) { 
// trigger before updation of the 
    List<Account> accList = new List<Account>(); 
// get list of all account which are upating 
        for(Account fetchAcc : Trigger.new) { 
// loop to handle bulk account record updation
            String sPhoneNum = String.valueOf(fetchAcc.Phone); 
// convert phone integer into string for further calculation
            if(!fetchAcc.Phone.isEmpty() && !fetchAcc.Name.contains(String.valueOf(sPhoneNum))) { 
// when phone is not empty and number is not added in name
            	fetchAcc.Name = fetchAcc.Name +'_'+ sPhoneNum; 
// update name in name_phoneNum format

Rama Gaikwad