You need to sign in to do that
Don't have an account?
Harold Crouse
ConvertedAccountID on Lead not matching report
So I'm trying to run a script that takes converted leads and copies their created date onto a field on the created account and I'm finding some strange things. Well things I thought weren't strange until I started investigating more. Script is simple
So as expected I'm finding multiple leads that contain the same ConvertedAccountID, I assume from converting a duplicate lead and chooseing merge into existing account. However when I run the leads with converted information report and include Account ID as converted Account ID is not available on the report; I see two different Accounts?
Results from the report:
Results from the query
I'm not sure what is happening here? Anyone have any insights?
map<id,DateTime> accountsWithDate = new map<id,DateTime>(); For(Lead l: [Select ConvertedAccountID, CreatedDate from Lead where IsConverted = true]){ AccountsWithDate.put(l.ConvertedAccountID,l.CreatedDate); } list<Account> accounts = new list<Account>(); for(Account a [Select id, Lead_Creation_DAte__c from Account where Id in: accountsWithDate.get(a.id)){ a.Lead_Creation_Date__c = accountsWithDAte.get(a.id); accounts.add(a); } update accounts;
So as expected I'm finding multiple leads that contain the same ConvertedAccountID, I assume from converting a duplicate lead and chooseing merge into existing account. However when I run the leads with converted information report and include Account ID as converted Account ID is not available on the report; I see two different Accounts?
Results from the report:
Results from the query
I'm not sure what is happening here? Anyone have any insights?