Loop iterates and enables to perform a specific operation on all the objects of an array. A Loop should be added as a child to the query step so that all the iterations brought as the response of the query can be traversed by the loop.
In this example, we will create a flow: "For each issue in GitHub, create an issue in Jira"
- Add a GitHub query "Get All Issues."
- Click on the "Add Step" button.
- Search and select "Loop."
- Enter 'Variable Name' where you want to store the objects of the array.
- Enter the 'Array' over which the Loop will iterate.
- You can directly provide your array here or use dynamic tags from any previous step. Learn how to add dynamic tags here.
- You can directly provide your array here or use dynamic tags from any previous step. Learn how to add dynamic tags here.
- Click Test.
- You will see a success message if the loop successfully traverses over every object coming in.
- Expand Iteration 1 to view the results.
- Click on 'Next Iteration' if you want to view the results of the next iteration.
- Similarly, you can keep on fetching the next iteration of the query and testing your Loop for every iteration until all the pages are exhausted.
- Click Test Again if you want to run the loop again.
- Click Done to collapse this step.
- Click Done to collapse this step.
- Click on the "Add Step" button.
- Search and select 'Jira.'
- Add the "Create Issue" action in Jira.
- Click "Add My Account."
- Sign up for free here if you don't have an account.
- Sign up for free here if you don't have an account.
- A new window will open up where you will enter your login credentials and click Proceed.
- Enter the 'Project' name in which you want the issue to be created.
- Enter the 'Issue Type'.
- Enter the 'Parent Issue' if you selected sub-task in the 'Issue Type.'
- This is an optional field and can be left empty.
- Select 'Assignee.'
- This is an optional field and can be left empty.
- This is an optional field and can be left empty.
- Enter the issue 'Summary.'
- Enter a 'Description.'
- This is an optional field and can be left empty.
- This is an optional field and can be left empty.
- Click Continue.
- Click Test.
- Expanding the Test Result shows that an issue has been created in the connected Jira account.
- When a user will set up an integration against the above flow, for each issue created in the GitHub, a "Create Issue" action is performed in Jira.
- All the issues from GitHub fetched by query will be reflected one by one in Jira.
- Save and publish your flow.
You can add as many steps as you need inside the Loop step, including additional queries or conditional logic. The flow will end, once the Loop has completed iterating through all records.
Comments
0 comments
Please sign in to leave a comment.