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
prathap raoprathap rao 

How to Identify a n Account converted from a lead and an Account from the Account tab.

Is there any way in Salesforce to identify the converted account when compared to an Account created from the Account screen.


Does Salesforce differentiate based on ID or is it just the Lead Report after conversion that we need to refer to see the converted accounts?


You can query Lead Object (Lead.ConvertedAccountId, isconverted = true) with the current accountid

to find out if its an Account converted from a Lead.





Find below a sample code of trigger to update the account field after lead conversion :


   trigger trigMapFields on Lead (before update) {



                if (lead.IsConverted)


                                // Assign the value from the Account "MasterContact"  lookup field to the ContactID"

                                system.debug('<!---------Convert Leads 222 --------->');

                                Account acc = [SELECT Id,MasterContact__c FROM Account WHERE Account.Id:lead.ConvertedAccountId];

                                Contact con = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];

                                acc.MasterContact__c =;

                                update acc;

                                system.debug('<!---------Check Account Fields 111--------->'  + acc.MasterContact__c);




Hope this helps.


This is  extrenely important functionality to lead management, success measurement in sales and lead performance

This needs to be implemented at the earliest possible time.


Thank you!

Roger WickiRoger Wicki
Account acc = [SELECT Id,MasterContact__c FROM Account WHERE Account.Id:lead.ConvertedAccountId];

I've got a question on the WHERE part of this statement: Doesn't there miss an operator? Or what does "Account.Id : lead.ConvertedAccountId" do?

So if I understand it correctly: during lead conversion, first the new account is created and then the lead updates to "isConverted = true"? Otherwise I could not see that this would help me.
Roger WickiRoger Wicki
I answer this question by myself:
First, an empty account is created and then updated with all the fields' information

And thus this thread is solved.
Egor VolkovEgor Volkov
If you select any existing account when convert Lead, the field Lead.ConvertedAccountId will be populated by EXISTING account Id.
So if you want to detect "was account created manually or from lead" you can compare Lead.ConvertedDate(Date type) and Account.CreatedDate(Datetime type). Or you can create checkbox in Account and fill it in the Lead trigger after converting.