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
Tunde OdutolaTunde Odutola 

Update task field with autolaunched flow

I have a developing a process builder to automate task creation and emails. I have a process that creates the first task and populates the custom program field.  The automation works fine when they save the record, however, users sometimes use create follow up tasks or new tasks so the program field is not populated and the automation would not work.
To deal with this scenario, I am using the same process builder to launch a flow update the program field but I am having a problem the flow keeps failing at the Update record stage.  I would appreciate ideas of how to get this to work and handle or prevents errors.
Thank you
Tunde OdutolaTunde Odutola
Flow Details
Flow Name: Retrieve_Related_Program
Type: Autolaunched Flow
Version: 4
Status: Active
Flow Interview Details
Interview Label: Retrieve Related Program 14/11/2017 16:11
Current User: Tunde Odutola (0053E0000013f9e)
Start time: 14/11/2017 16:11
Duration: 4 seconds
How the Interview Started
Tunde Odutola (0053E0000013f9e) started the flow interview.
Some of this flow's variables were set when the interview started.
VarTRelatedToEO = a0P58000006PFmnEAG
RECORD QUERY: GetRelatedEODetails
Find one EnrollmentrxRx__Enrollment_Opportunity__c record where:
Id Equals {!VarTRelatedToEO} (a0P58000006PFmnEAG)
Successfully found record.
{!VARRelatedToProgram} = Masters
RECORD UPDATE: Update_Related_Program
Find all Task records where:
Related_Program__c Equals
Update the records’ field values.
Related_Program__c = {!VARRelatedToProgram} (Masters)
Failed to update records that meet the filter criteria.
Error Occurred: Too many DML rows: 10001
Salesforce Error ID: 1850051042-8761 (-1741830137)
Rich FiekowskyRich Fiekowsky
It RTEs because there are too many Tasks on the system which match "Related_Program__c Equals" (in your log); they may be old forgotten Tasks. (Derelict Task records can result from Email-To-Case setups, and other ways.)  There are so many, the "Find all Task Rrecords" fails - internally, it finds them with a query, on which the governor limit is 10000 rows.
Solution is to filter out all irrelevant Task records, starting with older Tasks based on "Date Created", which is always indexed.