Flows begin with an Event. Often that event will be tied to an application (e.g. new records in Salesforce). This topic covers two alernatives: A Schedule event or a Child Flow event.
A “Child Flow” event is used for a Flow that runs when called by another Flow.
This is useful when:
- You have a series of steps that get used more than once in a single Flow or across multiple Flows. Moving them into their own “child Flow” lets you create them once and then reuse them repeatedly. You run the steps from other Flows by using Call Flow or Call Flow Async.
- You want to process a list, one item at a time. For instance, you can run a series of steps on each list item using For Each or you can transform a list into a new list (one item at a time) using Map.
- Or, if you just want to break a very large Flow into smaller, more manageable parts.
Each Child Flow card has the following outputs:
- Inputs to this Flow
- Click to create custom fields, one at a time. Give each a name and data type (such as Text or Number). Each custom field you create corresponds to an expected input from any Flow that calls your child Flow.
- Context - the outputs in this section are automatically assigned values every time the Flow runs:
- Index - This number output is assigned a value when the Flow is called from a function that loops through the items of a list (e.g. a For Each or Map function). The value of _Index_ corresponds to the item’s position in the list (starting with zero) processed by this particular instance of the Flow.
- Caller - The keys of the Caller object tell you which Flow called the child Flow (id and name), which particular execution of the Flow made the call (_executionid), and which particular step in the Flow (method, which is an unique ID). When the child Flow is manually run, then id and _executionid are null. This is especially useful for debugging purposes.
- Error - This object output is assigned a value when the Flow is called for Error Handling. The value of Error corresponds to the raw error object returns by the application or action that caused the error – e.g. an object that will often have keys that include “message”, “statusCode” and “execution” (the unique identifier of the Flow execution that caused the error, which can be used to construct a URL to the execution history that shows the Flow details that led to the error).
- Execution ID - the unique ID of the Flow instance.
Note: A Child Flow must be turned on before it can be called by other Flows.
A “Scheduled Flow” event is used for a Flow that runs according to a schedule, such as once an hour, 5pm on Fridays, or at 9am on the first day of every month.
Adding a Scheduled Flow event prompts you to provide the schedule details. You can change the schedule by clicking the clock icon at the bottom of the card. (Note: You can similarly adjust the schedule of most application events. For instance, you can set a Salesforce - New Record event to check for new records every Friday at 5pm rather than every 5 minutes.)
The schedule goes into effect only after the Flow has been turned on.
Each Scheduled Flow card has the following outputs:
- Current Time - the date and time that the current instance of the Flow was initiated (in ISO UTC format). This can be passed to any text or date & time input.
- Execution ID - the unique ID of the Flow instance.
Starts a Flow whenever a custom web form is submitted. (Available as an Event choice if included in your plan.) The form is automatically generated using the fields that are added to the card.
Step 1: Create a field for each input you want on the form
Each custom field that you create on the card will result in an input field added to your custom form. They look like output fields on the card (that can be used to map values to later steps in your Flow). But, after step 2, you’ll be able to preview the actual form or access it via a web page.
For each field, use the type dropdown to configure the form inputs:
- Text - appears as a text input box on the form
- Number - like a text input box, but only accepts valid numbers
- Date - appears as a date picker control on the form
- True/False - appears as a checkbox on the form
- File - appears as a file picker on the form, with a “Choose File” button
- Customize… - gives access to changing the display name as well as optional default value and optional help text. The display name shows up as the form control label (e.g. the text of the checkbox). Optional help text appears as a non-bold subtitle beneath the label.
Step 2: Save and Turn On the Flow
Once you’ve saved and turned on the Flow, you’ll be able to preview your form by clicking the “form” link at the top of the card or the “Form Settings” button on the bottom. You’ll be give a URL that leads to the form or the iframe snippet to embed the form in an existing web page.
Step 3: Build the rest of your Flow
The Flow will run each time someone clicks the “Submit” button on the form and will pass all of the input values. Drag and drop your form fields to later steps in the Flow to run actions or functions on those values.
Use a Return card at the end of your Flow to display one or more values to the form user when the Flow completes, e.g., show a custom message and/or calculated results.
In addition to the form fields, all Form cards have one additional output field, called “Execution ID,” that does not appear on the form. It’s assigned a unique value every time a new form is submitted.