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

  1. In your Salesforce account, launch Flow Builder.
  2. In the top menu bar, select New Flow.
  3. Select Record-Triggered Flow from the options, then select Create.
  4. Under Select Object, search for Lead.
  5. Under Configure Trigger, select A record is created or updated.
  6. Under Set Entry Conditions, select None.
  7. Ensure the field Optimize the Flow for is set to Actions and Related Records.
  8. Select Done.

Step 2: Create a Referred By Code field

  1. In your Salesforce account, open the Setup page.
  2. Go to Object Manager.
  3. Select Lead.
  4. Select Fields & Relationships from the sidebar.
  5. Select New.
  6. Choose the Text data type, then select Next.
  7. In the Label field, enter Referred By Code.
  8. Optionally, add a description.
  9. Select Next.
  10. Select which profiles should have access to the field depending on your organization structure, then select Next.
  11. Select which page layouts should display this field. All is the recommended option.
  12. Select Save.

    Step 3: Create a decision based on the Referred By Code field

    1. In Salseforce, within your new flow, select + [Add] between the Start and End of the flow.
    2. Select Decision from the Logic section.
    3. In the Label field, add a title: Has Referred By Code Been Added?.
    4. Optionally, add a description.
    5. Ensure New Outcome is selected.
    6. Under Condition Requirements to Execute Outcome, select All Conditions Are Met (AND) from the dropdown list.
    7. 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.
    8. From the Operator dropdown list, select Is Null.
    9. In the Value field, type false and hit Enter or Return.
    10. Select Default Outcome and change the label to Referred By Code is blank or similar.
    11. Select Done.

    Step 4: Create an action to send the Referred Lead to impact.com

    1. In Salesforce, within your flow, select + [Add] on the Has Referred By Code branch of the flow.
    2. Select Action under the Interaction section of the list.
    3. In the New Action window, choose Type in the Filter By dropdown.
    4. Select Apex Action from the list.
    5. Select the Action field, then select Upsert User by ID.
    6. In the Label field, type Upsert Referred User to impact.com.
    7. Optionally, add a description.
    8. For both the accountId and userId fields, select Lead from the dropdown list, then scroll down to select Email.
    9. Use the sliders to map the fields you want to send between Salesforce and 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

    1. In your Salesforce account, launch Flow Builder.
    2. In the top menu bar, select New Flow.
    3. Select Record-Triggered Flow from the options, then select Create.
    4. Under Select Object, search for Opportunity.
    5. Under Configure Trigger, select A record is created or updated.
    6. Under Set Entry Conditions, from the Condition Requirements dropdown list, select All Conditions Are Met (AND).
    7. Select Field, then select customerEmail.
    8. Select Operator, then select Is Null.
    9. In the Value field, type false and hit Enter or Return.
    10. Select Add Condition to create a second condition.
    11. Select Field, then select StageName.
    12. Select Value and select Closed Won from the dropdown menu.
    13. Ensure the field Optimize the Flow for is set to Actions and Related Records.
    14. Select Done.

    Step 2: Create an action to send the Closed Won event to impact.com

    1. In Salesforce, within your new flow, select the + [Add] after the After Last label in the Flow.
    2. Select Action under the Interaction section of the list.
    3. In the New Action window, choose Type in the Filter By dropdown.
    4. Select Apex Action from the list under the Filter By dropdown.
    5. Select the Action field and select Track Event by Email.
    6. In the Label field, type Send Closed Won to impact.com.
    7. Add an optional description.
    8. Set input values for the accountId and the userId fields.
    9. In the Key field, type closedWon.
    10. Select Done.

    Step 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.