This lesson will cover the following topics:

03 | Loop

01 Getting Started

This tutorial covers using Loop in Titan Flow. Loop is useful when you are working with multiple records in Salesforce. For our example, a list of contacts will be pulled from Salesforce and an email will be sent to each of those contacts.

02 Salesforce Action

1. Click the Any + icon, choose Salesforce Action as the node, and click Next.

Add Salesforce Action node

2. Click the Salesforce Integration button.

Click Salesforce Integration

3. Under the Get Records tab, click Create New.

Salesforce Integration window

4. In the Object Settings tab, configure: Contact as the Salesforce Object, User Action as the Trigger, add a description, and configure the number of contacts to pull.

Map Salesforce fields window showing the object settings tab

5. In the Conditions tab, configure the Email to Contains and click + Add Variable.

Map Salesforce fields window showing the conditions tab

6. Add a variable and label it email_condition. Click Apply.

Custom variables window showing static tab

7. Map the email condition to the email_condition variable.

Map Salesforce fields window showing the conditions tab

8. In the Mapping tab, click + Add Variable.

Map Salesforce fields window showing the mapping tab

9. Add a variable and label it email_addresses_to_send. Click Apply.

Custom variables window showing the static variables tab

10. Map the email_addresses_to_send variable to the Email Salesforce field. Click Apply and Close.

This variable will hold each email value separated by a comma.

Map Salesforce fields window showing the mapping tab

11. Use the dropdown to select the configured Salesforce Get and click Next.

Add Node / Salesforce Action window showing selected node

12. Enter a Tag and click Insert.

03 Loop

1. Click the After Finish + icon, choose Loop as the node, and select Next.

Add a loop node

2. Use the Loop On Element dropdown to select the variable email_addresses_to_send. Set the split delimiter to a comma and click Next.

Add Node / Loop configuration

3. Enter a Tag name and click Insert.

04 Send Email

1. Select the For Each + icon, choose Send Email as the node, and click Next.

Adding send email node

2. Click the My Emails + icon.

Add node / send email screen showing my emails option

3. In the Recipients tab, use the To dropdowns to select the Loop-value field. This will use the email value from the loop.

Configure email settings window showing recipients tab

4. In the Send Via tab, configure the email you want to use to send your emails.

Configure email settings window showing send via tab

5. In the Content tab, you can configure the body of your email.

Configure email settings window showing the content tab

6. Configure your attachments, click Apply, and Next.

7. Enter a Tag name and click Insert.

05 Continue the Loop

Once the email has been sent, the loop must continue to run afterward. This will ensure that the loop will continue to run after the first email is sent.

1. Click the Send Email + Icon, choose Continue as the node, and click Next.

Add continue node

2. Enter a Tag name and click Insert.

Ensure that you configure a Finish node in the Loop. Save and publish the Flow.

Screenshot of the selected finish node


06 Invoking the Flow

A simple web project was created with a text field and a button. 

1. Navigate back to your web project.

2. Click the Interactivity icon from the button menu.


3. Click the Start + icon, choose the Flow node, and click Next.

Choosing the flow node

4. Use the dropdown to select the Loop Flow.

5. Disable Run in Background.

6. Click Configure Parameters.

configuring the flow

7. Configure the email_condition to the text field. Click Apply.

Configure parameters window

8. Click Next, enter a Tag, and click Insert.

When a user provides an email address and clicks the button. The flow will trigger to retrieve the contacts in Salesforce and send the configured email to the contacts.

Preview of the example project

07 Got Feedback?

Additional Resources