The CreatorCon Call for Content is officially open! Get started here.

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

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

Hi @Zach Koch

 

I actually managed to fix the issue - turned out it was incorrectly looking up the demand stakeholder records and therefore the for each wasn't looping through records. Guess it was the wrong data_p*ll. I now have it incrementing correctly (basically if there is at least one active user then increment and if it is still 0 at the end then email a notice). 

 

Will do a bit more fleshing out of the loop next week but fingers crossed, will be sure to mark your reply as the solution once it's wrapped up. 

Great, glad that helped!

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,

 

Wanted to pick your brain on this issue:

 

I have the flow finalized and it's working as intended except I can see a potential issue (see screenshot)

 

Essentially I have a nested For Each cycling through the Stakeholder Records for a given Demand Record. I want to see if any of the Stakeholder user records are active, if not, then send an email and inform them. 

 

The issue I'm seeing here (circled in the screenshot) is that I think I'd need this If statement check to fully run against all the Stakeholders before hitting the second IF which sends out the email. 

 

Otherwise I could see a scenario where the very first Stakeholder record has an inactive user, so it would send an email. However maybe there's a second Stakeholder record tied to that Demand and therefore shouldn't be an issue. 

 

I feel that maybe the second IF should be moved outside the For Each in some way but not 100% (see arrow in screenshot)

 

Just curious on your thoughts regarding this. 

Yes I would recommend moving your second If statement to where you have indicated on the arrow. This will ensure that ALL stakeholders on the record are checked for active before the notification goes out. As you have it now you are correct, it could send it out if the first one was inactive, but the second one was active. 

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

 

Modified the workflow and it's working perfectly. Greatly appreciate your help on this. I've accepted your original post as the solution since it resolved the initial issue.