Forum Academy Marketplace Showcase Pricing Features

Create an action for each item in a custom state list

Hi!

I have a data type Team which can contain a list of team members (users). I can create a workflow to create the team and add a list of team members.
In my app the selected users are added to a custom state list. When the user clicks the Save button, the team is created and the team members list is added to the Member’s field.

Now I would also need to have the team to be stored in the User data type (field: Team). So I need to find a way to iterate through the custom state list to run a workflow for each item in that list.

I looked at a plugin called Ultimate Toolkit but as there’s no documentation at all, I can’t figure out how that would work.

Does anyone know how I can create a foreach logic?

Thank you for your guidance!

You can use a plugin, in the way you are heading. Alternatively use a backend workflow which can take arguments of lists of things. This gives you a “for each” capability.

I do it something like this:

1 Like

Hi,

Thanks for your reply!
I tried creating backend workflows but I can’t figure out how to create an action on a custom state list. It seems like I can only take arguments on a list of items in the database.

Do you know if there is a way to do an action for each item in a custom state list?

Thanks again!

I tried creating backend workflows but I can’t figure out how to create an action on a custom state list. It seems like I can only take arguments on a list of items in the database.
Do you know if there is a way to do an action for each item in a custom state list?

Sure there is…

Just set the ‘List To Run On’ to be the custom state list. Although if you’ve already created the Team and added that list of User’s from the custom state to the Team’s Members field in the first step of your workflow you can also use the results of step 1’s Members as the list of users to send to the backend workflow.

Having said that, unless I’ve misunderstood your question, there’s no need to use a backend workflow at all here - you can use the ‘Make Changes To a List of Things’ workflow action on the page instead (as long as it’s not a very large list it should work fine)…

All you need is to run a workflow (on the page) with 2 steps:

  1. Create a new team, and set the list of Members to be the custom state list of Users.
  2. Make changes to a list of things (the Users from the custom state list OR the result of step 1’s Members) and set the Team field to be the results of step 1 (the newly created Team).

If the list of members is likely to be very large (i.e. more than 100), then you might well be better off using a backend workflow rather than making changes to the list of things on the page.

In which case just create a backend workflow to change a User by setting the team field to the newly created team, then run that workflow either on the custom state list of Users, OR on the newly created team’s list of Members.

2 Likes

Hi Adam,

Thank you for your advice.
I managed to do it with making changes to a list of things, like you suggested, thanks!

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.