4

We have a requirement to delete all converted leads whose corresponding contacts have been deleted. Upon implementation we noticed something odd:

After creating and converting a lead via UI (classic only in this case) we deleted the contact again (and emptied the recycle bin).

Now, after executing the following SOQL query,

SELECT Id, Name, Status, IsConverted, ConvertedContactId, ConvertedContact.Name FROM Lead WHERE IsConverted = true

our result looks like this: Query Result

Notice that:

  1. There is still a contact ID stored in ConvertedContactId (even though the corresponding contact has been deleted)
  2. The relationship query to ConvertedContact.Name returns null

For me this seems very odd, since I don't know about any other situation where Salesforce would keep an ID to a deleted record in a reference field.

My questions now:

  1. Can anybody explain this behaviour?
  2. Does Salesforce (at some point) clear the ConvertedContactId field (since I found some converted leads without any value in that field in our production org and the only way to convert a lead for our business user is via Standard Classic UI)
  3. Is there another reliable and straight-forward way for a nightly batch to identify leads whose conversion-contacts have been deleted during the day?

Edit Jul 10 2018: one more thing: After a couple of days, the ID of the deleted contact is actually removed from the converted lead. I did not try to determine the exact time though.

Thanks

  • 3
    That sounds like a bug. I suggest logging a case. Even if the contact is only soft deleted, the field should appear null. – sfdcfox Jun 8 '18 at 18:43
  • Ok thanks. I did just that and will share any updates. – Christoph Jun 11 '18 at 13:05
  • 1
    Finally got a response from Salesforce. Apparently that behavior is considered "works as designed". The reason (according to SF support) is "to be able to restore the link between contact and converted lead when a contact is undeleted". – Christoph Jul 10 '18 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.