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
Nick PaivaNick Paiva 

Flow isn't looping through the record that started it?

Hey team,

I'm running into a problem with my flow. It works in a way.

I'll attach a picture of the flow (let me know what other information is needed).

Basically, we're trying to add up cases owned by contractors and subtract it from a number to see how many are left for that month.

So, first, there's a process builder to update a checkbox (if secondary owner is a contractor, mark "true" on Contractor_Case__c).

The flow itself is triggered whenever the secondary owner field is changed, and the "Contractor_Case__c" case is checked.

The flow then makes a choice on which product family the case belongs to. So say it's a Customer Experience case. It pulls every Case with a due date of this month, and where the contractor_case__c is checked yes. 

It loops through them all using an assignment element, it "adds 1."

After the loop, it takes thosed added numbers and subtracts it from 5 and updates Contract Cases Remaning field. 

---

The flow works if there was already an existing case with that criteria.

Meaning, when the first Customer Experience case comes in, the "Contract Cases Remaning" field is blank.

When the second one comes through, it updates that field with "4," accounting for that first one, but not accounting for the case that triggered the flow.

Any ideas on what I'm doing wrong?

User-added image