Your First Flow

This is a simple flow that will send you an email.  The purpose of this flow is to get you started building flows and demonstrate how steps interact with one another.


Your account must have flow author permission to create a flow.

Create the Flow

Add a Trigger and Steps

Add the First Step

This code breaks down as follows: 

The square brackets denote that this is an array.  You can add other email addresses by enclosing them in straight single quotes and separating the values with a comma within the brackets .

Add the Second Step

The first icon is highlighted.

5. Enter return flow.step('map-variables').output[0].emailAddress;

The code breaks down as follows:

6. Skip the Attachment section.  You can include a single attachment on an email step, but we aren’t going to use it in the sample flow.

7. Enter return flow.step('map-variables').output[0].subject; in the Subject expression box.

enter return flow.step('map-variables').output[0].body; in the Body expression box.

8. Select Save at the bottom of the step window.

Save and Run the Flow

Review the Flow Run

When the flow status updates to Success, you should see the email in your inbox.


In App Xchange, click anywhere on the Success line to see the Run Details page. The header section lists various statistics of the flow run.  You should see that one email was sent. 


Select 1 Email Sent to see the code version of the email.

Manage the Flow Configuration

When you hardcode email addresses in a flow step, it can be inconvenient for troubleshooting and updating the step.  Now we’ll set up a configuration to hold one or more email addresses and modify our flow step to use those values instead of using the hardcoded email address.


6. Select the Configure icon in the upper right.

7. Select the blue plus sign and enter your email address in the box.  Select the blue plus again if you want to add more than one email address.

8. When you are finished adding email addresses, choose Save.

9. Select X to exit this window.

10. Select the Send Email step.

11. Enter  return flow.config.emailAddresses; in the Emails expression box, replacing what is already in there.

In this code we add the Key from our Configuration to flow.config.  Because we defined the Configuration type as Multiple Text Items, it will be interpreted as an array of strings which is what the Emails expression box expects.

12. Select Save at the bottom of the window.

13. Choose Save and Deploy to Staging.

14. Select Promote to Main.