Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Chaining Flows

This is a real use-case for an integration I do with my client. I have modified the concept to show you but the process is the same.

The scenario is we have some Properties and the Properties are sold by Brokers. We have an external website where we display the properties for sale. From the time the properties are advertised on the site, until the sale goes through, that is all handled on the external website. The external website has a custom built integration with Salesforce.

Flow - Property-CreateOnWebsite

  • The Subflows are mocking up to create the property on the Website.

  • They would normally be Actions.

  • The first decision checks to see if the broker is already on the website, if not we are going to create the broker on the website.

  • We can’t continue wit the rest of the flow until the broker is on the website.

Let’s look at the Pause Element, where all the action happens.

  • We always Pause

Now the Resume

  • We resume when a Platform Event Message is Received

  • Where the Record ID is this Broker

  • And a text string named Flow Stage is BrokerCreated

  • Once that Platform Event is received then we can resume.

Push Property to Website

  • And wait again.

The Finish the Flow

Now let’s look at the Platform Event

  • The PE is Flow Control

It is just like a Custom Object

  • It is set up in a very generic way so I can use this for this flow, and other flows, and it can do different things based on the value passed in to Flow Stage

  • So there is nothing to creating a Platform Event.

But how do we Publish a Platform Event?

PE-FlowControl-Broker

  • A Simple After Update Flow Trigger on Broker

  • After the Website ID is updated

This should include an ISCHANGED on Website ID so for now, until Flow Triggers Support ISCHANGED, use a Process Builder to publish the Platform Event. It is exactly the Same.

Create the Platform Event Record - Publishing the Platform Event

So let’s see it in action

Firstly we will look at the website.

Mock Website https://jodiem.formtitan.com/origin/ft5f37318e1604833404141/origin/?device=Desktop#/

  • We are going to pretend this is the back end of the website

  • We have some properties and some brokers on the website

We look at Michael Jones

  • He is on the website and has an ID of 5

Let’s look at Salesforce

  • These are the same properties

Let’s look at Architectural Details

  • Caroline is not on the website, nor is the Property.

  • The status is Pre Market

Now let’s run the Flow

I am running this as an Autolaunched Flow firing from a Process Builder at the moment. You can’t have Pause Elements in Record Triggered Flows (YET - hopefully it comes).

  • Change the Status to be Ready for Website

We can see the Paused Flow Interview

  • The Flow is paused until the website finished creating the broker and let’s Salesforce know the broker is updated.

Let’s review.

  • How is the flow going to resume?

Update the Website ID

  • This is where we are pretending to be the website updating salesforce with the new Website ID

  • Enter the Website ID and Submit

Now we go back to the Paused Flow Interviews

  • The Wait for Broker is no longer waiting, there is now a Wait for Property.

And we go to our Property record

  • Caroline is now on the Website.

But back at the back end of the website

  • The Property is not yet created

Remember in real life this would take a matter of seconds… I’m really slowing it down so you can see.

So we go to the Property record on the website

  • And pretend the website has completed creating the property. It would have to upload and resize the photos and add watermarks and produce a PDF to download etc.

  • We submit the value.

Now let’s check what’s done.

  • Our paused interview has gone.

  • So that means our Platform Event has fired.

  • We received a notification

  • The property is now available and on the Website.

we send a notification to the user so they don’t have to wait around or keep refreshing the page. If we do end up getting Live Records that was touted at TDX last year, you could stay on the record and see it update automatically. But for now Notifications work.

NOTE: Notifications ONLY work IF the user has cleared their notifications! More than 20 notifications and you don’t get “notified”

The website is updated

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.