Example Salesforce Flows for Advocate
Note You must have a Salesforce for Advocate integration set up in order for flows to work properly. For instructions, refer to Integrate with Salesforce for Advocate.
Your Salesforce for Advocate integration relies on flows to share data between impact.com and Salesforce. At minimum, a user upsert (or attribution) flow is required. Optionally, an event tracking flow can be added. Additional flows may be useful for your program as well. Work with your impact.com-assigned implementation engineer or our support team for guidance on the recommended approach.
Below are generic examples of an attribution flow that upserts users from Salesforce to impact.com, as well as an event tracking flow that sends order details from Salesforce to impact.com.
Attribution flow
Attribution flows can be set up to upsert users from Salesforce to impact.com whenever new Leads contain a Referred By Code
.
Step 1: Create a new flow
- In your Salesforce account, launch Flow Builder.
- In the top menu bar, select New Flow.
- Select Record-Triggered Flow from the options, then select Create.
- Under Select Object, search for
Lead
. - Under Configure Trigger, select A record is created or updated.
- Under Set Entry Conditions, select None.
- Ensure the field Optimize the Flow for is set to Actions and Related Records.
- Select Done.
Step 2: Create a Referred By Code
field
Referred By Code
field- In your Salesforce account, open the Setup page.
- Go to Object Manager.
- Select Lead.
- Select Fields & Relationships from the sidebar.
- Select New.
- Choose the Text data type, then select Next.
- In the Label field, enter
Referred By Code
. - Optionally, add a description.
- Select Next.
- Select which profiles should have access to the field depending on your organization structure, then select Next.
- Select which page layouts should display this field. All is the recommended option.
- Select Save.
- In Salseforce, within your new flow, select + [Add] between the Start and End of the flow.
- Select Decision from the Logic section.
- In the Label field, add a title:
Has Referred By Code Been Added?
. - Optionally, add a description.
- Ensure New Outcome is selected.
- Under Condition Requirements to Execute Outcome, select All Conditions Are Met (AND) from the dropdown list.
- In the Resource field, select Record / Lead from the dropdown list, then scroll down to select Referred By Code The final result should look like:
$Record > Referred By Code
. - From the Operator dropdown list, select Is Null.
- In the Value field, type
false
and hit Enter or Return. - Select Default Outcome and change the label to
Referred By Code is blank
or similar. - Select Done.
- In Salesforce, within your flow, select + [Add] on the Has Referred By Code branch of the flow.
- Select Action under the Interaction section of the list.
- In the New Action window, choose Type in the Filter By dropdown.
- Select Apex Action from the list.
- Select the Action field, then select Upsert User by ID.
- In the Label field, type
Upsert Referred User to impact.com
. - Optionally, add a description.
- For both the accountId and userId fields, select Lead from the dropdown list, then scroll down to select Email.
- Use the sliders to map the fields you want to send between Salesforce and impact.com.
- In your Salesforce account, launch Flow Builder.
- In the top menu bar, select New Flow.
- Select Record-Triggered Flow from the options, then select Create.
- Under Select Object, search for Opportunity.
- Under Configure Trigger, select A record is created or updated.
- Under Set Entry Conditions, from the Condition Requirements dropdown list, select All Conditions Are Met (AND).
- Select Field, then select
customerEmail
. - Select Operator, then select Is Null.
- In the Value field, type
false
and hit Enter or Return. - Select Add Condition to create a second condition.
- Select Field, then select StageName.
- Select Value and select Closed Won from the dropdown menu.
- Ensure the field Optimize the Flow for is set to Actions and Related Records.
- Select Done.
- In Salesforce, within your new flow, select the + [Add] after the After Last label in the Flow.
- Select Action under the Interaction section of the list.
- In the New Action window, choose Type in the Filter By dropdown.
- Select Apex Action from the list under the Filter By dropdown.
- Select the Action field and select Track Event by Email.
- In the Label field, type
Send Closed Won to impact.com
. - Add an optional description.
- Set input values for the accountId and the userId fields.
- In the Key field, type
closedWon
. - Select Done.
Step 3: Create a decision based on the Referred By Code
field
Referred By Code
fieldStep 4: Create an action to send the Referred Lead to impact.com
Step 5: Review and test the flow
If the Flow looks complete, select Save to save your work.
You can use the Test and Debug tools to run the flow and review the outcomes. To fully test the Flow, create a new lead with a “Referred By Code” manually added to that field. The user should appear in your Advocate program's participants list after a few minutes.
Opportunity-Closed Won flow
You can set up an Opportunity-Closed Won flow to send an event to impact.com when the associated Opportunity gets to the Closed Won stage.
Step 1: Create a new flow
Step 2: Create an action to send the Closed Won
event to impact.com
Closed Won
event to impact.comStep 3: Review and test the flow
If the Flow looks complete, select Save to save your work.
You can use the Test and Debug tools to run the flow and review the outcomes. To fully test the Flow, convert the lead from above into an Opportunity and then push it to a Closed Won stage. The closedWon
event should appear in that participant's profile in impact.com after a couple minutes.
Updated about 1 month ago