Part 2: Manipulate Complex Internet Data in Flow Without Code

Working with Rich Web Data in Flow

This is a PREVIEW of Summer 19 Functionality. Please make your purchase decisions based only on generally available products.

Let’s recall the problem we’re trying to solve. The web data that’s returned by our Mulesoft product API packs three different SKU’s into a single ‘WebProduct’. Every time we get a result from this API, we need to unpack it and create multiple Product records in Salesforce:

This image has an empty alt attribute; its file name is image-2.png

Here’s the flow we’ll use:

The two Extract assignment elements are extremely important: they take the two Lists that are part of the product and store them in variables. But we handle them slightly differently. Recall that this is what the object looks like:

Because the picture URLS are simple strings:


we can create a standard collection variable of type Text to store them as a group:

But the identifiers are more complicated:

so we store them in a resource that uses the new Apex-Defined type:

Here’s how we configure one of the resources we’ll use:

Note how you select the specific Apex Class that indicates the structure of the data you’ll be storing.

Extracting Subobjects

An important part of the process is extracting copies of the subobjects (in our case it’s the SKU identifiers and the URL Product Images) into record collection variables that use the new Apex-Defined type. Once the data is in record collection variables, we can Loop over it in Flow.

Note the use of dot notation in the Value field. I was able to select this value without typing:

However if you need to go more than one level deep, you’ll have to type in the dot notation yourself, as in the case of the Pricein this example:

Recall that our goal is to end up with three products. We generate the product data by looping over the identifiers and assembling a collection of products. A second loop enables us to add the appropriate picture URL to each of the products. Finally, we save the collection of records to Salesforce.

Good luck with your flows!

New Version of Load Web Page Flow Screen Component

The old version of Load Web Page used an event-based architecture that doesn’t work in all Salesforce environment.

Here’s a new version that should work everywhere: Install

Provide it with a url that has the “http://” in front of it.

Seamless Flow Handoffs from Users to Agents

Users can start flows and then pause them, and those same flows can be made to appear on the user’s Contact record where an agent can resume and complete the flow.

This requires and relies on the Guided Action List’s ability to find and display all paused flows associated with a record.

The Community user must be a signed in Salesforce user. They can’t be a Guest User.

Flows can be linked to a Record

Flow provides a mechanism that allows individual flows to be linked to records. This means that a flow about a Contact can be linked to a particular Contact via that Contact’s Id. Or a flow could be linked to an Asset or a custom object record. The main benefit of doing this is that when the record page is displayed for that record, if the record page has a Guided Action List component, it will display all the linked flows that are 1) In Progress or 2) Paused. And in the case of flows that are Paused, the user looking at the record page can resume the flow.

Enable Flow Handoffs By Linking The Flow To the User

In order for a Flow started in Community Cloud to be resumable by an agent in Service Cloud, have the Flow populate the Flow Global Variable $Flow.CurrentRecord must be assigned the value of the current UserId.

Tip: The Contact Id of the currently logged-in Community user is the same as their UserId.

Flow provides access to the Global Variable $User and $User.Id will return the currently logged-in user’s Id. Assign this value to the recordId resource that you created:

When the Guided Action List is on a record page, it queries to see if there are any Flows in progress or paused that are linked to the current recordId, and it does this by checking for the presence of a value in a resource called recordId. So, you will need to be on the Contact page corresponding to the user in order to see their paused flows.

A final note: The Guided Action List component is only available in the Lightning Experience so you’ll need to be in Lightning to use this process.

Learn how to Insert Images in Flow Screens

There’s a new blog post on Salesforce’s official blog channel covering the use of the official, bundled-with-Flow Display Image screen component. Check it out.

There’s also the more powerful, less polished Image screen component that continues to be available on this community site. The original post on that.

Here’s a post we did on overriding the Footer buttons with a custom image.

New Flow Action: Get Distance between Cities

There are scenarios where you need to know the distance between two specific cities and use it in your flows. Now you can easily do it using this new flow action. Grab an unmanaged package here, install it to you Salesforce organization and add it to your flow. Alternatively, you can grab the source code from GitHub and push to your org.

Internally this action utilizes Google Maps API so you will need to get developer key. You can request one here. After you got the key and installed the package, go to Setup -> Custom Metadata Types -> Google API Key (click ‘Manage Records‘ next to it). There will be just one record of this type: open it and paste your developer key into Key field.

Google API Key

Configuring Google developer key

The configuration is pretty straightforward: give it two cities (optionally with country names for disambiguity) and use the output distance measured in miles or kilometers.

GetDistance Input Values

Input values configuration

GetDistance Output Values

Output values configuration

If everything is fine parameter Is Success will contain True value. Otherwise, it becomes False, and Error Message will contain detailed description of the error (e.g. source or destination were not found or there are no routes between them). The distance (both in miles and in kilometers) are rounded up to 3 digits.

GetDistance Example

Example of the message constructed from the output parameters

Source Location and Destination Location output parameters are the source and destination input parameters converted to a universal form City, State, Country (e.g. Los Angeles, CA, USA)

The Definitive Guide: Connecting Platform Events to Flows

Platform Events and Flows are a perfect match, but to get them to work with each other, you need to go through Process Builder and deal with several interesting wrinkles. Learn More.

Converting a Flow Builder Flow Version Back to Cloud Flow Designer

Please note: this is the unofficialsf.com blog, and this post is as unofficial as they come. The following technique is offered without warranty or support.

The Spring ’19 release of Flow Builder has some gaps in functionality — such as copy and paste — that some people have found necessary to be efficient when building flows. While the Salesforce teams are working on filling in the gaps, it is possible (in Spring ’19) to re-enable Cloud Flow Designer in the Process Automation Settings by deselecting the “Disable access to Cloud Flow Designer” option. When this option is deselected, flow versions that were saved in Cloud Flow Designer are opened Cloud Flow Designer, and flow versions that were saved in Flow Builder are opened in Flow Builder.

But what if you’ve made — and saved — a bunch of changes to your flow in Flow Builder, and only then you decide you want to go back to Cloud Flow Designer? Well, the engine that runs your flows is the same for both versions: although the user interface for building the flow has changed, the metadata created by Flow Builder is pretty much the same as the metadata created by Cloud Flow Designer. There’s nothing in theory to prevent a flow version that was saved in one tool from being opened in the other, except that there isn’t a means to do it in the user interface.

The following technique allows you to move a Flow Builder flow version back to Cloud Flow Designer. Again, this is not supported by Salesforce: you’re going to want to test your flow carefully after you move it back to Cloud Flow Designer. But if you’ve done a lot of work on your flow in Flow Builder already and you really feel like you need to go back to Cloud Flow Designer, and reverting to a previous version isn’t an option, this solution may work for you.

  1. Enable access to Cloud Flow Designer by deselecting the “Disable access to Cloud Flow Designer” option in Process Automation Settings.
  2. If you’re in Lightning, switch back to Salesforce Classic. (This is temporary – it allows you to see and modify the flow version IDs in the URL. You can turn Lightning back on when you finish moving your flows.)
  3. Open the Flow Builder flow version you want to move. Look at the browser URL bar: it will be something like https://org.lightning.force.com/builder_platform_interaction/flowBuilder.app?isFromAloha=true&flowId=301B0000000TWbNIAW (the part after “301” will be different for you).
  4. Copy the part of the Flow Builder URL that starts with 301 (e.g. “301B0000000TWbNIAW”). This is the flow version ID.
  5. Open a flow version that was created in Cloud Flow Designer. Any flow will work, it doesn’t have to be the same one that you opened in Flow Builder. Look at the browser URL; it will be something like https://org.my.salesforce.com/designer/designer.apexp#Id=301B0000000TSW8IAO (again, the part after “301” will be different for you).
  6. Replace the “301…” part in the Cloud Flow Designer URL with the ID that you copied from your Flow Builder version in step 4 (in my example, the modified URL would be https://org.my.salesforce.com/designer/designer.apexp#Id=301B0000000TWbNIAW).
  7. Press Enter in the URL bar to load the new flow ID into Cloud Flow Designer. You might have to press Enter a couple of times before the browser actually reloads — you’ll know it’s loading the new flow because you’ll see a progress indicator.
  8. Save the flow as a new flow or flow version. You now have a version that has all the changes from your Flow Builder flow, but can be opened in Cloud Flow Designer.

At this point, test your flow and make sure that everything is still working as expected. I verified that this worked for my flow by saving the Cloud Flow Designer version as a separate flow, adding both flows to a package, exporting it in Workbench, and doing a diff on the files: the only difference in the metadata was the name and an additional processMetadataValues element in the Flow Builder flow indicating that it was created using Flow Builder. You don’t have to test it my way. But you should still do some tests before continuing to enhance the flow. If you find it’s not working the way you expect, you can still return to your previous version.

You can now continue working on the flow in Cloud Flow Designer. You can also switch back to Lightning.

Note that in July 2019, Chrome, Firefox and other browsers will start to make it more difficult to enable the Flash plugin that is required to use Cloud Flow Designer, as the browsers prepare for Adobe’s end of life for Flash. If you’re comfortable staying in Flow Builder now, you should. But if it’s really not working for you right now, I hope this will help until Summer ’19 rolls out.