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
MT DevMT Dev 

Converted Leads go to Recycle Bin

I know I can't access the recycle bin via the API. However, is there a property on a lead that can be checked  via the API to see if a lead is in the recycle bin? When I query for leads, the leads that are in the recycle bin are returned.

Thanks,
Chad
darozdaroz
If the lead was deleted it enters the recycle bin and can no longer be accessed via tha API - except by the getDeleted() call. (That call will only return the lead 00Q... id, no data is available).

I think what you may be seeing are leads returned in the API that you can't 'see' in the UI. Chances are you're seeing converted leads. There is a boolean you can return called IsConverted that will tell you if the lead is converted. If converted you cannot edit it, but can use it for reporting or historical purposes. You can also get the Account, Contact and (optional) Opportunity that was created during the conversion.
MT DevMT Dev
I may have to do more testing here, but this is what I'm seeing:
 
1. New Lead enters db
    -shows in GetUpdated with CreatedDate in last pull timespan
2. Lead gets converted to contact
    -shows in GetUpdated for Contact but Contact.CreatedDate not in last pull timespan (I think it's the Lead CreatedDate that migrates?)
    -GetUpdated for Lead shows nothing
    -GetDeleted for Lead shows nothing
    -Query for all leads shows record, but the lead is not available via the Salesforce.com UI.
 
I have to admit, there is wiggle room in my findings as I've only done two tests. Ideally, if a lead is moved to the recycle bin, it will show in a GetDeleted call, but that hasn't been the case in my experience.
 
Thoughts?
darozdaroz
What you have is substancially correct, but I'm not 100% on getUpdated() not returning a newly converted lead (I think it should, but I honestly don't use it - too inefficient).

MT DevMT Dev

Hmmm, interesting. So do you use a normal query using the last modified date to avoid doing a GetUpdated / Retrieve (therefore 2 round trips)?

Also, I noticed a few fields called ConvertedContactID / ConvertedDate / IsConverted. It seems that may be a reliable way to say the lead is no longer around (at least in the sense of being a lead and not a contact). Would that be the best method to evaluate the lead status? And, just because I'm curious, do the leads stay around forever if they have been converted to a contact or do they get removed after 30 days (or some other number)?

Oh, and as far as the GetUpdate not being in the list of items, I was incorrect. My apologies for the false claim.

-Chad

darozdaroz


MT Dev wrote:

Hmmm, interesting. So do you use a normal query using the last modified date to avoid doing a GetUpdated / Retrieve (therefore 2 round trips)?

Also, I noticed a few fields called ConvertedContactID / ConvertedDate / IsConverted. It seems that may be a reliable way to say the lead is no longer around (at least in the sense of being a lead and not a contact). Would that be the best method to evaluate the lead status? And, just because I'm curious, do the leads stay around forever if they have been converted to a contact or do they get removed after 30 days (or some other number)?

Oh, and as far as the GetUpdate not being in the list of items, I was incorrect. My apologies for the false claim.

-Chad




That's correct, I use a normal query() call and filter on SystemModStamp instead of LastModified though. I've never actually witnessed it (that I recall) but I believe there are cases a record can get changed but LastUpdated not changed. I believe it is possible it may have something to do with a record deleted that is referenced in a lookup field.... regardless...

If IsConverted == true the lead is not visible in the UI any longer and is only visible in reports. It is also uneditable at that point. ConvertedAccountId, ConvertedContactId and ConvertedOpportunityId will have the Ids of the converted to records (if any).

Lastly converted leads do not get removed from the system (but you can use the API to delete them by ID -- useful if you convert a 'test' record and want to expunge it).


MT DevMT Dev
All very good to know. I'll work on modifying my queries and get this rolling again. Thanks for all the great advice and info!

-Chad
DalStar1999DalStar1999

"If IsConverted == true the lead is not visible in the UI any longer and is only visible in reports. It is also uneditable at that point. ConvertedAccountId, ConvertedContactId and ConvertedOpportunityId will have the Ids of the converted to records (if any)."

I have a side question. If the converted lead is available for reports, and it is showing the original information that the lead contained at the time it was converted - as opposed to any changes that were made later in the contacts/opptys - where is this information stored and why cannot it be accessed and edited? I have tried using Excel Connector and it will not allow editing of this information. Yet, for various reason, I do need to edit some text in the lead source field. if the info is available and can be pulled by a report, it must be residing somewhere in SF that can be accessed somehow. Any help on this?

Thanks.