+ Start a Discussion
sales@myvarmasales@myvarma 

hey when new lead converts to account if the new account name already their the data in new account must update in old account any one help me

when ever we insert record in account if same name exist then the data must update in old record 
help me 
Shaijan ThomasShaijan Thomas
Hi Pradeep

You have to have a trigger in account and develop a mechanisam to achieve this

Thanks
Shaijan
sales@myvarmasales@myvarma
send me i m fresher trying to learn bro
Shaijan ThomasShaijan Thomas
what need to send?
 
sales@myvarmasales@myvarma
if any code related that
Shaijan ThomasShaijan Thomas
if you realy trying to learn please do not ask any code, try yourself from google.
All the Best
sales@myvarmasales@myvarma
at least tell me errors bro 
 

trigger tocAccountTrigger on Account (before update) {  
Map<Id, Account> newAccountMap = Trigger.newMap;
if (Trigger.isBefore)
{
if (Trigger.isUpdate)
{
for (Profile p : [select name from Profile])
for (Account a : Trigger.new) {
if (((a.IBM_Id__c == '' || a.IBM_Id__c == null) && a.tocSourceSystem__c=='IBM') )
{
a.IBM_Id__c.addError('IBM Id should be present');
}
for (Account oldAccount : Trigger.old)
{
Account newAccount = newAccountMap.get(a.Id);

if ((newAccount.tocSourceSystem__c=='IBM')&&(newAccount.IBM_Id__c != '')&&(p.name != 'System Administrator'))

OwnerId = oldAccount.OwnerId; newAccount.Name = oldAccount.Name;
newAccount.tfcmCustomerName__c = oldAccount.tfcmCustomerName__c;
newAccount.Phone = oldAccount.Phone;
newAccount.Fax = oldAccount.Fax;
newAccount.ShippingStreet = oldAccount.ShippingStreet;
newAccount.ShippingCity = oldAccount.ShippingCity;
newAccount.ShippingState = oldAccount.ShippingState;
newAccount.ShippingPostalCode = oldAccount.ShippingPostalCode;
newAccount.ShippingCountry = oldAccount.ShippingCountry;
newAccount.Segment__c = oldAccount.Segment__c;
}
}
}
}
}
}