Skip to main content

Looping

Loop runs actions on each item in a list, like participants, products, or action items.

Swyft AI avatar
Written by Swyft AI
Updated this week

The Loop action lets you iterate over a list of values and perform a set of actions on each item. This is useful when you want to apply the same logic to multiple items, such as meeting participants, products, or action items.


How It Works

  1. Select a List Variable

    • In the Loop editor, choose a variable that contains a list of values.

    • Examples:

      • {{organization.user_emails}} – Emails of all users in your organization

      • {{meeting.participant_team_ids}} – Team IDs of meeting participants

      • {{associated_crm_records.hubspot_deals.products}} – Products tied to a Deal

  2. Define Loop Iteration Actions

    • Inside the Loop Iteration block, add the actions you want to run for each item in the list.

    • Each loop iteration exposes a current item variable ({{loop.current_item}}) representing the value being processed.

  3. Use Downstream Actions

    • The output from each iteration can be passed into later workflow actions.

    • Example: When looping over participants, the current item ({{loop.current_item}}) can be used to create a contact or assign a contact role.


Best Practices

  • Split to List for Generated Insights

    • When a Generate Insight action produces multiple values (like products, action items, or competitors), enable “Split to list.”

    • Swyft will automatically break the text into separate items you can loop over.

    • Example: “Products: Analytics, Security, AI” → [Analytics, Security, AI].

  • Fail Early Inside Loops

    • Add conditions at the start of the loop to filter items.

    • Example: Only process a participant if they don’t already exist in CRM.

  • Use with Dynamic Variables

    • Loops work seamlessly with Conditions and Dynamic Variables for granular control.

    • Example: For each product, log it to the Opportunity only if it’s not already attached.

  • Minimize Expensive Actions

    • Avoid heavy actions (like Slack alerts or multiple CRM writes) inside large loops.

    • Instead, aggregate results and send a single update afterward.


Example Use Cases

  • Loop through meeting participants – Create contacts for participants who don’t already exist in the CRM, or assign them contact roles on the associated deal/opportunity.

  • Loop through products discussed – Log each product mentioned in the conversation to the opportunity for accurate product-level reporting.

  • Loop through action items from a meeting – Create a CRM task for each action item identified in meeting notes to ensure nothing falls through the cracks.

Did this answer your question?