You can use Start Loop (a Workload Utility app) to create a loop through an iterable list of data, like rows from a spreadsheet, to fire off individual actions as part of a workflow. Simply place the “Start Loop” app at the beginning of your loop sequence and select the field you want to loop on. Set up the rest of your steps and then place an “End Loop” app at the end of your loop.
Example #
You are pulling data from an HR app with a list of employees. The list isn’t static, meaning new employees are joining all the time. You want to add all the new employee’s email addresses to a Slack channel. Instead of adding them to Slack one-by-one, you can use Start Loop step followed by a Add to Slack Channel action. This will loop through the Add to Slack Channel step once for each new employee. This way, you only had to set up the Add to Slack Channel action once.
“As a Senior Talent Acquisition Partner at Rubius Therapeutics, I was tasked with providing an internal weekly report on the recruiting status of our open jobs. Workload helped me automate the process of organizing data from Lever, our applicant tracking system, into an easy-to-follow Excel spreadsheet that I receive via email every week and share with my team. Workload’s automation has saved me countless hours of manual work!”
— Kelly Burke, Sr. Talent Acquisition Partner at Rubius Therapeutics
How to create a loop in Workload #
To create a loop inside of a Workload automated workflow using the editor:
Time needed:Â 3 minutes.
- Make sure your data is in an “array”, or a list of items.
Usually you can tell this is the case because you’ll see a numeric heading before the data in your test data view, like in the image shows.
Here you can tell it is a list of items because of the numeric headings plus the output field called “messages” that has no value associated with it other than this list (which has values nested inside). - Add a Start Loop app
In the workflow edit view, click the “+” sign on the last node to add a new step (or drag and drop it onto the canvas for bonus points!).
Click on the “TOOLS” tab and then start typing into the box, “Start Loop”. You should see it appear now. Select it and click “CONTINUE” - Set up the loop
Choose “startLoop” as the action and then set up the loop. To do this, in our example, simply click into the field labeled “array” and select “messages” from the accordion dropdown menu!
Then hit “CONTINUE” and then “TEST DATA”. You should see data appear as just the first element of your list returned. No worries! It’s not a bug. We are just showing the first iteration of the loop to use as an example while you’re building the workflow. - Test the loop data
Press continue and “TEST DATA” to make sure you get a screen similar to this. Don’t worry that the whole list isn’t there anymore! We’re just showing you the first item to use as an example for the rest of the loop’s actions.
- Add Actions
Add the actions you want to complete for each item in your workflow. For this Gmail example, we’re going to add the email address and subject line to a Todoist Task.
In order to achieve this, we’ll need to add a next to Find the email by ID. This way we can parse out the message and display the email information beyond just a threadID and email message ID. Make sure to use the Start Loop fields in your reference mappings!
Once you have test data output from that step, go ahead and add the step to Create a Task in Todoist. Map the correct fields and now you’ll have a workflow that looks like this: - Add the End Loop step
This step is so easy! Just add the End Loop from the “TOOLS” tab of the action setup menu. Then to set it up just click on the Output data heading from the original Start Loop action.
- That is all!
You can either keep building your workflow by adding steps after this. They won’t be affected by the loop and will run only once for the entire workflow. As always, if you have any questions you can always ask them in the chat widget from the lower right corner of the workflow editor! We’re always here to help.