AI Assistant
Help Center AI Assistant is now available
Got questions about Lark? Use our AI chat to find the answers.
00:00
Click and hold to drag
Got It
Try Now
Use loops in workflows

Use loops in workflows

6 min read
Available with these plans:
Starter
Basic
Pro
Enterprise
5
5
1,000
1,000
The above figures refer to the maximum number of loops per node under different paid versions. The Lark Basic version only supports specific countries and regions. To upgrade your Lark Plan or for more information, contact Support or your Customer Success Manager.
I. Intro
In Base workflows, you can use loops to configure rules for repeating the same action until a task is completed.
Note: Loops only work with arrays, which are data structures containing collections of elements of the same type. For example, the records or columns (person, group, or attachment fields are supported) that meet the conditions for the Find records action are considered arrays.
Use cases:
  • Sending to-do lists to specified members: Check tasks that are in progress and send reminders to the respective task owners every week. The reminder should only contain the tasks owned by the corresponding member, so that everyone will only receive the relevant information.
  • Isolating interview records: For all interviews completed on the same day, a new record is automatically created for each interviewer to record the interview results, and a message will be sent to remind them to fill out the form. The interviewer can directly fill out the form to add the record to the base by clicking the button in the message card. In this way, they won't see the results of other interviewers or receive irrelevant notifications.
  • Batch adding members to multiple groups: If multiple groups are added to a group field, you can use the loop function to conveniently add members to multiple groups at once.
II. Steps
Select the loop action
  1. Open a base and click Workflow in the lower-left corner to create a workflow.
  1. Select a trigger, click Then do this and select Loop.
  • Note: Up to 5 loops can be added in a workflow.
250px|700px|reset
Configure loop settings
You can configure the following settings for the loop node:
250px|700px|reset
  • Types of loop: Currently, you can only select Run action for each item once, which performs the same action on a set of data in order. For example, you can send reminders to the owner of each task in the task list or mark each task in the task list as complete.
  • Note: The Continue looping if conditions are met option is not available yet.
  • Group to loop through: This field is required if Run action for each item once is selected. Here, you can only select the data generated in previous steps. The array types that can be selected include:
  • json.array output by HTTP requests or webhook triggers.
  • When the trigger is When a new record is added, When a record updates, When a new or updated record matches conditions, or At record's trigger time, or when the action is Add record or Update record, you can select the person, group, or attachment fields that are the output of these steps.
  • Note: There can be multiple persons, groups, and attachments in a single cell.
  • When the action is Find records, you can select its outputs, including All records found and Certain value of a field found in all records. For Certain value of a field found in all records, you can only select person, group, and attachment fields.
  • Maximum number of loops: Enter the maximum number of loops you want to run in this node. When the maximum number of loops is reached, no more loops will be executed. The maximum number of loops per node depends on your Lark plan. Refer to the table below for details.
  • Lark plan
    Starter
    Basic
    Pro
    Enterprise
    Max loops per node
    5
    5
    1,000
    1,000
Note: The Lark Basic version only supports specific countries and regions.
  • When loop gets stuck: During the execution of the entire loop, if an error occurs at any point, you can choose to either Skip this loop only or Stop performing loops.
  • If you select Skip this loop only, then some loops may succeed while others fail. You can check the status details in the activity log.
Configure loop body setting
After configuring the loop node settings, you need to configure the settings for the loop body, which specifies the actions to be repeated.
Loop body settings refer to any actions added to the loop shape in the picture below.
250px|700px|reset
Add an action
Click the + icon in the loop shape to choose from a series of actions or add another Loop node to create nested loops. You cannot add If/Else actions in a loop. You can create nested loops of up to three levels in a workflow.
250px|700px|reset
Use data output by a loop
You can reference the data output from a loop in steps that come after the loop by selecting Item in loop or Current number of loop iteration.
When the data from the loop is from a particular field, you can directly select Item in loop. When the data from the loop is from All records found, you need to click Next to select the specific field.
250px|700px|reset
Note: The data output by a loop can only be used within the loop itself. You cannot reference the data output by a loop in any nodes after the completion of the loop.
III. Use cases
This section shows how to send specified records to members to demonstrate how the loop function can be used.
Scenario
When managing tasks, you may need to send different to-do lists to different task owners. Each to-do list should only contain the tasks owned by the corresponding member.
Without the loop function, a common approach is sending the entire task list to everyone using the Owners field, which is not only inefficient but may result in data leakage. With the loop function, you can send to-do lists to designated members at designated intervals.
The process is as follows:
250px|700px|reset
Steps
Preparation: Open the base and create a table called Tasks. Input information such as Tasks, Priority, Owners, and Status. Next, create a workflow.
250px|700px|reset
  1. Select At scheduled time as the trigger. Set the trigger time to Monday morning at 10:00 AM and select Every weekday.
  1. Add a Find records action to find all tasks in progress. Select the table that contains the tasks, and set the condition to Status is In progress. For Select fields, select the Owners field.
250px|700px|reset
  1. Add a Loop action and configure the loop settings.
  1. Select Run action for each item once under Types of loop.
  1. Under Group to loop through, click the input box, hover over 2. Find records, and click Next. Then hover over Certain value of a field found in all records, click Next, and select Owners.
250px|700px|reset
250px|700px|reset
  1. Enter the Maximum number of loops and select what to do when the loop gets stuck.
  • The above settings indicate the same action will be performed on the owners of all the records found in the second step.
Next, specify the specific actions to be executed within the loop. First, search for all tasks owned by a member, then send them a message reminder.
250px|700px|reset
  1. Add a Find records action and add two conditions: Status is In progress and Owners contains 3. Loop > Item in loop.
  • Set the field content you want to search for as needed. Here, it is set to Tasks, Owners, Status, and Latest notes.
250px|700px|reset
250px|700px|reset
  1. Add a Send a Lark message action. Under To, select 3. Loop > Item in loop to select the data output by the previous step.
  • Enter the Title and Message as needed. In the Message area, you can click the Reference value icon to reference the data output by the loop. For example, you can reference the name of the task owner and the corresponding task.
250px|700px|reset
250px|700px|reset
Effect
In this example, the table contains four tasks with a status of In progress, and their owners are Alice and Simon respectively.
250px|700px|reset
Once the loop comes into effect, each of them will receive reminders for their respective tasks and will not see other tasks. The images below show the messages they will see:
250px|700px|reset
IV. FAQs
If I modify the content in the table after the workflow loop has started, will the loop be affected?
No, it will not be affected. Once the loop is triggered, the number of loops and the actions are fixed and will not change.
What is the maximum run time for a workflow with loops?
The workflow can run for 3 hours at most. There will be an error if a workflow runs for more than 3 hours.
What is the maximum number of loops that can be added in a workflow?
Five.
What is the maximum level of loops that can be nested in a workflow?
Three.
250px|700px|reset
How is the number of runs calculated when using loops in workflows?
It is calculated based on the total number of executions of the entire workflow, rather than the number of loop iterations. You can also check the activity log of the workflow for more details. Each row corresponds to one run. For example, in the picture below, although the number of loop iterations was 2, this was only counted as one run.
250px|700px|reset
Written by: Lark Help Center
Updated on 2025-03-17
How satisfied are you with this content?
Thank you for your feedback!
Need more help? Please contact Support.
0
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom