Workflows are actions that you want to perform on form submission. There would be scenarios like getting customer data and sending newsletters based on customer preferences or say getting data for the Slack users of a channel and sending them messages or updates regarding say the downtime or new releases and so on. These are a group of tasks of your workflow that should be carried out when a certain condition is satisfied. For this, Studio has the Iterate Task under Workflows that allows you to group together the tasks that need to be repeated till the condition is true.
Let us take an example here to send an email containing the Invoice generated as a PDF attachment for the different products added. Here we have a form for purchasing products. The fields are added to a form multirow to enable multiple products at the same time.
The Generate invoice button is a Submit button to which a workflow would be linked. This workflow contains the tasks to generate individual PDFs and send emails to the user making the purchase.
Add a Workflow to the Screen and enter a self-explanatory name. Click to Open the task.
Let us now configure the Iterate task. So under Logic Tasks, select Iterate Task and click Continue.
Here you would be selecting the group data source for which the task would be iterated. So select the productname, description, quantity, price, and amount fields from the list and click Continue. It is important to add all the group data that is to be iterated.
Add a Task Name. You can also enter the condition to When to execute this task and the task description for further explanation. Click Finish.
Note that the Task start and end-point are added under the task. You can add the repetitive tasks here.
Let us assume that we already have a PDF created for Invoice generation. Add a Generate PDF task. Link all the variables from the submitted form and click Done.
After the invoice is generated, we want to send it through an email to the user entering the data. So for the sake of this example let us take a Gmail connector task to send email to the respective user.
Authenticate the Gmail account, enter the receiver and sender’s email addresses, the necessary text or HTML message, and add the PDF generated in the previous task as the attachment.
Click to Continue, add the task name, and Finish.
Here we have added only the two tasks for the sake of the example. You can add as many tasks as required.
It is very important to note that a maximum of 50 iterations is allowed. The group data exceeding 50 will not be taken into consideration. It will not appear in the workflow analytics as well.
Now here let us see the preview when we run the form and submit the data to the iterate tasks.
Thus you can see here that the two tasks for Invoice PDF generation and sending email were repeated twice for the two products that were added to the form.
You can make use of the iterate task where such repeated tasks need to be performed, sending email containing instructions to multiple employees from the Employee Sheet, sending Slack messages to channel users regarding a recent development or release date and so on.