Creating a Connection To Another Org That Your Flows Can Use
The Run a Flow in Another Org action makes it possible to create highly customized no-code interactions between two of your orgs. If you don’t have a lot of experience hooking up orgs to talk to each other, here are some tips.
The Relationship Resources
Given two orgs, a Source Org that’s going to run a flow with an action that runs a flow (or does something else) on another Target Org, you need to create an authentication relationship between them.
On the Target Org, you create a Connected App. This confusing name might better be called an Access Point. It provides a way for the Source Org to gain access to the Target Org.
On the Source Org, you create a Remote Site Setting. This is also a confusing name. I’d probably have called it something like an Authorized Target Destination. This allows the action to make an outbound callout. Even though the two orgs are not only both ‘in’ Salesforce and also part of your enterprise, the security infrastructure treats them as isolated islands (this is basically a good thing for your company’s security).
Creating a Connected App
When you create a Connected App in setup, you do so from Setup –> App Manager. You can select from a variety of security mechanisms for your authentication. In this example, we’ll use a relatively low security solution involving username and password. Note that Salesforce recommends you use higher security solutions such as those making use of digital certificates. The full range of authentication solutions is beyond the scope of this page.
Here’s an example of a Connected App that requires the calling Flow to provide a username and password of an account on the Target Org:
To assemble the Callback URL and the URL that you’ll use in your Flow Action, use the ‘Current My Domain URL.
Potential Gotcha: There are similar URL’s that you can find in places like your web browser that will not work! For example, the Strawberry org displays this similar URL:
…but this will not work for connection configuration.
Configuring a Flow Action to call a Salesforce Org
Once you have a Connected App as shown above, make note of the Consumer Key and Consumer Secret. Now we go over to the Source org. In this example, we’re configuring the Run Flow in Another Org action. Here’s a working configuration:
You can see that we’ve pasted in the Key and Secret and also provided a Username and Password from a User on the Target Org. Importantly, note that this User account’s Security Token is appended to their password. Security Tokens are never displayed on a Salesforce screen. If you don’t know the existing Security Token, you can generate a new one by going to the User Settings:
If you have your configuration correct, then when the action runs it should be able to successfully make a connection: