How to get Row Count in Workflow Studio?

MBarrott
Mega Sage

I'm wanting to create a daily scheduled flow which will review active demand records and check to see if there is at least one active stakeholder assigned to the demand record. 

 

Right now I have a look up action which conditionally pulls all the relevant records, however I'm unsure on the best solution to loop through each found record and see if the total number of active stakeholder records is <1.

 

I built a For Each flow logic but I can only see if the Stakeholder is Active or False, no way to get a total for Active Stakeholders. 

 

Any help would be appreciated. 

1 ACCEPTED SOLUTION

Zach Koch
Giga Sage
Giga Sage

I went ahead and mocked up the flow. The overall flow would look something like this, only using incident as an example.

ZachKoch_0-1718385218155.png

Here is what your flow variable would look like

ZachKoch_1-1718385248478.png

Here is setting the flow variable to 0

ZachKoch_2-1718385286979.png

and you can update the count with something like this

ZachKoch_3-1718385313307.png

here is where you can use that Flow variable to compare against

ZachKoch_4-1718385403724.png

 

If you have any more questions, please let me know.

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

10 REPLIES 10

Zach Koch
Giga Sage
Giga Sage

You could leverage Flow Variables. In your For each loop, add 1 to your flow variable, then use a condition of If <flow_variable> Is greater than 1, then set your required actions. If you need help with how that would look, let me know and I can mock something up.

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Zach Koch
Giga Sage
Giga Sage

I went ahead and mocked up the flow. The overall flow would look something like this, only using incident as an example.

ZachKoch_0-1718385218155.png

Here is what your flow variable would look like

ZachKoch_1-1718385248478.png

Here is setting the flow variable to 0

ZachKoch_2-1718385286979.png

and you can update the count with something like this

ZachKoch_3-1718385313307.png

here is where you can use that Flow variable to compare against

ZachKoch_4-1718385403724.png

 

If you have any more questions, please let me know.

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Hey @Zach Koch

 

Thank you for the help on this. I do now have a counter variable but running into issues when attempting to loop through the stakeholder records to see if at least one is active. Seems to be failing at the second for each loop

 

MBarrott_0-1718393016259.png

 

Do you have a screenshot of the error in the flow context where it fails?

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!