Trigger Integrations from Logic
Last updated
Last updated
On our Business Tier, you can trigger integrations using Feathery's Javascript Rule Builder. This allows you to trigger these integrations at any point of your form and under any conditions that you set.
Here are the steps to trigger integrations:
In the integration tab of your form, define an integration action (such as our Salesforce integration) using the Custom Logic
trigger. An integration action is a single action for a given integration (ex: Create / Update for a certain object type in Salesforce)
Then, once you press Save, an ID will appear at the top of the integration. You can copy that ID (or multiple IDs)
Then, within a Logic rule, you can use the no-code "Run integrations" action or feathery.runIntegrationActions function to trigger the integration.
For the on-code action, use the "Run Integrations" action in the no-code logic builder and select which integration(s) you want to run. The "wait for completion" toggle determines whether you want to wait for the integration to finish before proceeding to the next step of the logic rule
If you want to use code, the function takes in the following parameters:
actionIds
: string[]: an array of all the integration IDs that you want to run in order
options
: JSON with the following attributes:
waitForCompletion
: boolean. Sets whether you want the form to wait until the integration is done running before proceeding. If true, the form will wait. If false, the integration will run asynchronously and let the user continue in the form.
multiple
: boolean. Sets whether you want to be able to run this integration multiple times for a single submission. If set to true, you can run an integration multiple times. Otherwise, if false, a given action can only be run once per submission.
Here is some sample code to trigger two Salesforce integration actions:
let accountCreation = await feathery.runIntegrationActions(['b1802192-d7be-4432-9916-e62f17d8b23a','93b378b5-34ec-4ae3-a644-e160a79486c2'], {"waitForCompletion": true, "multiple": false} );
Integrations triggered from Logic also support dependencies. For example, creating a Salesforce account and then a contact that is associated with that newly created account. For Salesforce actions, you can enable this by using the "Create or Update Record" Salesforce action, and then selecting the object type you want to create/update (ex: Contacts, Accounts, Custom Objects, etc). Then, under the "Linked Object Fields" section, you can see all of the related object fields for the chosen object type. You can link those related object fields to the objects created or updated by any other integration action.
To do this, in the field dropdown, there are options for ID - Action <Action_ID>
. These map to any previously created Salesforce integration actions.
When you link these fields, then when this integration is run, it will reference the ID of the created Object associated with the action of the field.
In the example below, I am calling two actions in order: b1802192-d7be-4432-9916-e62f17d8b23a
( which creates a Salesforce Account) and 93b378b5-34ec-4ae3-a644-e160a79486c2
(which creates a Salesforce Contact).
In the second action that creates the Contact, I have defined the Account ID field (found in the Linked Object Fields header) to link to @ID- Action b1802192-d7be-4432-9916-e62f17d8b23a
. This means that the created Contact will be linked to the newly created/updated Account from the first action.
I then need to make sure I call these actions in the right order within my Logic rule. I need to ensure that the Action ID for the Create/Update Account action comes first before the Contact action.
Code Snippet: let accountCreation = await feathery.runIntegrationActions(['b1802192-d7be-4432-9916-e62f17d8b23a','93b378b5-34ec-4ae3-a644-e160a79486c2'], {"waitForCompletion": true, "multiple": false} );