Autolaunched flows

What if you don't need a user interface but want to implement complex automated logic for your records?

This is where the autolaunched flow type comes into play. Here, we can define a Process Builder with a flow action to trigger the flow logic when a specific event occurs on an object type (for example, an opportunity is created).

The toolbox changes slightly for autolaunched flows:

Autolaunched flow toolbox

The Screen element disappears, while the Pause element is added to the Logic elements section.

This particular element, which can only be run on autolaunched flows, is used to put the logic in a waiting state until specific conditions are met.

It is composed of the following:

  • One or more pause configurations: These define (pretty much like we've seen in the Decision element) different paused paths that can be resumed with specific configurations:

Pause configuration and conditions in the Pause element
  • One or more resume events: These define the events that resume the flow for a given path; they can be based on a simple date/time value (fixed or resource-based) or on a platform event:

Resume event for a given pause configuration

Here is a quick example:

Example of an autolaunched flow with a Pause element

This flow, coupled with a Process Builder on the opportunity object, sends an email alert (using an Email Alert action):

  • 7 days after the Close Date for opportunities with an amount greater than $1M
  • 14 days after the Close Date for opportunities with an amount greater than $100k and less than $1M
  • No notification if the opportunity is less than $100k
  • Updates the opportunity's Notification Date (a date/time custom field) when the flow has completed

The flow is configured like so:

  • The opportunity resource, which is of the variable and record type (of the Opportunity type), is available as an input resource (it can be passed in from the calling Process Builder).
  • A Pause element, which specifies three configurations:
    • One for an amount greater than $1M with a 7-day resume event (Big Deal).
    • One for an amount greater than $100k with a 14-day resume event (Mild Deal).
    • A default one with no resume event

This is the configuration of Mild Deal pause conditions:

Pause Configuration for mild deal path

This is the configuration of the Resume event for the Mild Deal path:

Resume configuration for mild deal path
  • Three Action elements for opportunity notification and one for Pause element failure (even the Pause element can fail). To do this, select the Action element, filter the actions by Type, select Email Alert, look for an already defined Email Alert action (we saw these when we talked about Workflows, Approvals, Entitlements, and Process Builder), and then set up the record ID, which should be the base for the email alert:

Email Alert action element configuration
  • One assignment element to assign the current flow date/time to the Notification Date custom field:

Assignment element configuration
  • One Update Records element to update the opportunity with the new assignment.

If the opportunity has an amount greater than $100k, an email alert is sent 7 or 14 days after the close date (depending on the actual amount); if the amount is lower, no email is sent. Regardless of whether or not the email is sent, the opportunity's Notification Date custom field is set up with the current flow's execution date/time, which will be set:

  • to the current date/time of flow execution for low deals
  • to the opportunity's Close Date field, plus 14 days (as for the resume event), for mild deals
  • to the opportunity's Close Date field, plus 7 days, for big deals (again, as for the resume event)

This means that the final Update Records element is executed in different contexts, depending on the path that the flow has passed through.

When the flow is paused, it is listed in the Paused and Waiting Interviews section of the Setup | Process Automation | Flows page:

Paused flows list

Now, you should have all the key elements so that you can start building your flows.

Unfortunately, it wasn't possible to cover all the properties and configurations that are available for flows. To deepen your knowledge of these additional elements, resources, and operators, please refer to Salesforce Help at https://help.salesforce.com/articleView?id=flow_ref.htm&type=5.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.27.211