This post is inspired by Tunde, a fellow reader, who asked a question on another post titled Advanced Lead Conversion with Process Builder. Tunde wanted to know how to update a Lead’s related Tasks during conversion. Their solution worked fine for when the Lead is being edited but was having no effect when the Lead became converted.
You might think that this could be achieved with a simple Update Records action using Process Builder. Whenever the Lead is being edited and its IsConverted field became TRUE then update related Tasks. Your process might have looked like this:
And 99% of the time you’d be right… except when the Lead is being converted into an Account and Contact.
Dude, where’s my related list?
As we discussed in my other post, Preserve Related Lists and Chatter on Lead Conversion, we learned that standard related lists are handled for us during conversion but custom related lists we have to move ourselves. Tasks and Activities are standard related lists, so they have already been handled for us when a Lead is being converted. By the time the Lead record is being handled by Process Builder, the Tasks and Activities records have already been re-parented to the converted Contact record. Their WhoId references the [Lead].ConvertedContactId now, not [Lead].Id.
Solution
Since the Tasks and Activities records have been re-parented to the converted Contact, what we need to do is modify our Process Builder to launch a Flow with one Record Update element in it to update the desired Tasks where their WhoId equals the Lead.ConvertedContactId.
Thank you Doug, this was like a ray of sunshine lighting up this issue. I have tried to create the flow but get an error on save that the flow is not connected to anything. When I run the flow i get the following error: INVALID_QUERY_FILTER_OPERATOR: SELECT Id, WhoId FROM Task WHERE ((WhoId = ‘(!varLead.ConvertedContactId)’)) ^ ERROR at Row:1:Column:36 invalid ID field: (!varLead.ConvertedContactId).
LikeLiked by 1 person
Hi Tunde,
Glad this gave some help!
Since the flow only has one element you will get warning it’s not connected to anything but that’s ok.
Is your flow activated?
In your flow, is your varLead declared as an sobject input variable?
In your process when launching the flow, are you passing in the input variable and referencing “the lead that started this process”?
I’m away from computer and not able to provide more screenshots of the setup right now.
Could you provide more images of your setup? You can share via google doc link or post them to my Success Community profile.
Thanks,
Doug
LikeLike
Hi Doug thank you for your time. I got it to work. 🙂 In your process when launching the flow, are you passing in the input variable and referencing “the lead that started this process”? That’s the bit I was missing. Having got that to work I am now trying to do the same to get Tasks updated when a Contact creates Opportunities. Wish me Luck. Thank you for sharing your knowledge.
LikeLiked by 1 person
Awesome!
LikeLike
Hi Doug,
Just an update to say I got the tasks to update when an opportunity is created on the contact. I used process builder to call a flow that did the rest. the flow was more complex than the one I did for the lead tasks on conversion but it all works fine.
LikeLiked by 1 person
Hi Guys. I hope this finds you well. I appreciate that your original conversation is a little old now, but I am trying to do the exact same thing with regards to closing Tasks (with Type criteria of ‘Other’) on conversion of the Lead. I have the Flow set up for the Record Update, and I have the Process Builder, but I am missing something in being able to connect the two. I have selected ‘Select the Lead record that started your process’ for the Select a Record to Update, but the I am getting stuck with completing the Process Builder. If either of you is able to offer any advice, I would really appreciate it! Many thanks 🙂 Hannah
LikeLiked by 1 person
Guys – stand down – I did it!! Thank you for this useful thread – I wouldn’t have been able to manage it without both your inputs/comments. Thanks! 🙂
LikeLiked by 1 person
Awesome!! Glad you got it working, Hannah!
LikeLike
Doug,
Would you mind providing some details on setting up the variable used in the auto launched flow? I think I understand the concept but am having trouble applying this solution to my company’s org in 2020.
I very well may have missed something…
Thank you!
LikeLike
I am working on this right now, thanks for the info.
Luckily for person accounts this does not happen as the Name ID can be populated in the process builder with the Lead.ConvertedContactID and the AccountID is automatically populated with the person account ID.
LikeLike