Microflow / loops

Hi,    Im wanting to create a microflow where it retrieves a list of projects, and then counts the amount of users assigned to each of the projects.  This is the project, user part of my domain model: However I am not sure how I should do this, I don't know whether i should use a loop for this action. But when I try to use the count function, I cannot select the Project_User association it only lets me count the number of projects in the list.   If anyone could help Id really appreciate it!!  
2 answers


In a microflow, you should

  • retrieve a list of projects. 
  • Then, you should create a loop using that list. 
  • In the loop, you will have access to one project at a time,  So inside the loop, you should retrieve a list of users associated with the project in the loop (typically, this will be called $IteratorProject).  Your retrieve will be via the Project_User association. 
  • Once you retrieve this list, you can use an aggregate list action to count them. 
  • Finally, I think you'll want to store that count somewhere - perhaps add an attribute to the Project entity called usercount?  If so, the final step in your loop will be to Change $IteratorProject and put the count you just created into this attribute.

Hope that helps,





sorry one more Q, I want to use the microflow for a pie chart. What would the return value be of the microflow? Iv tried a few different options but its throwing back errors. This is what it looks like so far: