Is there a way to use the Process Builder to complete a recurring task when a lead is progressed to a specific stage? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Ben ClarkBen Clark 

Is there a way to use the Process Builder to complete a recurring task when a lead is progressed to a specific stage?

Hi, 

So I have a process builder that creates tasks automatically depending on the stage your Lead is on.

Two of my stages create a recurring task, which last X amount of days.

And then finally I have a stage which when the lead is moved into it marks any open task as "complete".

My question is, when the stage of a lead is moved into one that creates the recurring tasks, and then moved into the stage which should complete them (ideally delete any open tasks but i couldn't find a way to do this), but it doesn't work and gives an error, (the completeing of the tasks works for any stage which doesn't have the recurring tasks) 

Below is my on screen error, followed by the email error, and below is some screenshots of my current process.

Lead page error -
"You encountered some errors when trying to save this record
We can't save this record because the “Lead Task Creation” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: ALL_OR_NONE_OPERATION_ROLLED_BACK: . You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 811682914-49825 (630282681)"

Email Full error - 
"Flow Details
Flow API Name: Lead_Task_Creation
Type: Record Change Process
Version: 3
Status: Active
Org: Atlantic Folk (00D0C0000000gvU)

Flow Interview Details
Interview Label: Lead_Task_Creation-3_InterviewLabel
Current User: Jude Ludgate (0054I000005Re0X)
Start time: 24/09/2019 08:50
Duration: 1 seconds

How the Interview Started
Jude Ludgate (0054I000005Re0X) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Lead (00Q0C00000265OEUAY)
myVariable_current = Lead (00Q0C00000265OEUAY)

DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals New

Default outcome executed.

DECISION: myDecision3
Skipped this outcome because its conditions weren't met: myRule_4
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals Initially_Contacted

Default outcome executed.

DECISION: myDecision6
Skipped this outcome because its conditions weren't met: myRule_7
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals 1st_Follow_Up

Default outcome executed.

DECISION: myDecision9
Skipped this outcome because its conditions weren't met: myRule_10
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals 2nd_Follow_Up

Default outcome executed.

DECISION: myDecision12
Skipped this outcome because its conditions weren't met: myRule_13
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals 3rd_Follow_Up

Default outcome executed.

DECISION: myDecision15
Skipped this outcome because its conditions weren't met: myRule_16
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals Regular_Conversation

Default outcome executed.

DECISION: myDecision18
Skipped this outcome because its conditions weren't met: myRule_19
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals GKIT_1_Month

Default outcome executed.

DECISION: myDecision21
Skipped this outcome because its conditions weren't met: myRule_22
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals GKIT_3_Month

Default outcome executed.

DECISION: myDecision24
Outcome executed: myRule_25
Outcome conditions:
{!myVariable_current.Status} (Passed To Distributor) Equals Passed To Distributor

DECISION: myRule_25_pmetdec
Skipped this outcome because its conditions weren't met: myRule_25_pmetnullrule
Outcome conditions:
{!myVariable_old} (Lead (00Q0C00000265OEUAY)) Is null true

Skipped this outcome because its conditions weren't met: myRule_25_pmetrule
Outcome conditions:
{!myVariable_old.Status} (GKIT_3_Month) Equals Passed To Distributor

Default outcome executed.

UPDATE RECORDS: myRule_25_A1
Find all Task records where:
WhoId Equals {!myVariable_current.Id} (00Q0C00000265OEUAY)
Update the records’ field values.
Status = Completed
Result
Failed to update records that meet the filter criteria."

User-added imageUser-added imageUser-added imageHopefully this is something thats possible,
Thanks.
Best Answer chosen by Ben Clark
Michael SandersMichael Sanders
Hey Ben -- I don't know the exact answer why this isn't working, but in my experience, Process Builder gets kinda squirrely in some circumstances when you're trying to traverse related records.  I've found this especially the case with respect to Tasks and Events.

However, I think you could accomplish this use case using a Flow that autolaunches when the Lead Stage changes.  In the Flow, you'd use a loop element to loop through all the tasks associated with that whoid and a record update element within the loop to mark them as complete.  Or, since it's using Flow, you could even delete the records: https://help.salesforce.com/articleView?id=flow_ref_elements_data_delete.htm&type=5

All Answers

Michael SandersMichael Sanders
Hey Ben -- I don't know the exact answer why this isn't working, but in my experience, Process Builder gets kinda squirrely in some circumstances when you're trying to traverse related records.  I've found this especially the case with respect to Tasks and Events.

However, I think you could accomplish this use case using a Flow that autolaunches when the Lead Stage changes.  In the Flow, you'd use a loop element to loop through all the tasks associated with that whoid and a record update element within the loop to mark them as complete.  Or, since it's using Flow, you could even delete the records: https://help.salesforce.com/articleView?id=flow_ref_elements_data_delete.htm&type=5
This was selected as the best answer
Ben ClarkBen Clark
Thanks Michael, I'm creating a flow to do this with being able to delete the tasks instead of having them be completed, which will be triggered by the process buidler upon the lead moving stage, appreciate the help!