+ Start a Discussion
Vinny PolisenoVinny Poliseno 

Mark Leads that have a Future Event

So I thought I finally found gold and was able to tag Leads that did or didn't have future events through a process builder...however, I'm running into Governor Limits through SFDC. Currently using a process builder to look at my Event Object where my event time hasn't passed and my WhatID is blank. Problem is all Lead have a null value on my WhatID which 82,539 Leads where Parent Account is null, As seen by this query :: SELECT count() FROM Lead WHERE Parent_Account__c = null.

There is a limit of 10,000 records which can be processed by DML statements in a transaction. This includes records that can be updated by a Process. As you can see I'm trying to update 82,539 Leads, which exceeds the 10,000 limit on records that can be processed by DML. So based on what I have built, the behavior is expected. I'm hitting the Governor Limit because the Process attempts to update too many records.

My desired result is to update the Lead record which a Task or Event is related to, that result cannot be achieved using Process Builder as the Task/Event "WhoId" is not an available target record for a Process Record update.

I want to update the Lead Record which a Task or Event is related to, I can either use a Trigger (I have ZERO knowledge of APEX), or a Flow (Very limited experience) called from the Process. Note that if doing this with a flow, at a high level, I just need to pass the Event id into a flow variable from a process, have the flow do a Record Lookup of that Event and fetch its WhoId, then do an update of Leads where the LeadId matches the Event WhoId).

Can anyone help me out here?