Process Builder - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Justin GermainJustin Germain 

Process Builder

Hello SF Community,


CONTEXT:


I'm currently working to automate our lead import process for sales development reps. The current process is they are adding into their sales engagement platform (Outreach.io) which then has a bidirectional sync with Salesforce to Create/Update the lead.


I have a process builder flow set up to check if a Field is set to a certain value everytime a lead record is updated/created. This field corresponds to a sequence name in their tool which is the same name official campaign names in salesforce.  For example, there might be a marketing campaign called "ABC Campaign" and there is a corresponding sequence in their tool (Outreach.io) that is named "ABC Campaign".  When they import leads into the sequence from ZoomInfo, the Bi-Directional sync in Outreach->Salesforce then updates a Field on the Lead Record Object.  If the field evaluates to true the process will add to the corresponding CampaignID in salesforce.  

PROBLEM:
Because the process builder is evaluating each time a lead is created/updated, I keep receiving error messages in email because it is possible that the lead is already assigned to the correct campaign.
 
I need to evaluate the lead to determine when the lead is updated/created that if a Field is set on the lead is the same as a campaign (already a campaign member) that it doesn't do anything or stops.

(Right Click and Open Image in New Tab to see larger size)

Step 1:

User-added image

 

Step 2:

User-added image

 

Step 3:

User-added image

 

Everything works beautifully, however, I get error messages when reps add new leads into their sequence and when it syncs to salesforce, if the lead is currently in the campaign it sends SF admins an error email.

Error Details:

Error element myRule_5_A1 (FlowRecordCreate).
This error occurred when the flow tried to create records: DUPLICATE_VALUE: Already a campaign member.. You can look up ExceptionCode values in the SOAP API Developer Guide.
________________________________________
Flow Details
Flow API Name: Add_Leads_to_Campaign
Type: Record Change Process
Version: 15
Status: Active
Org: Clairvoyant (00D3i000000t8rR)
Flow Interview Details
Interview Label: Add_Leads_to_Campaign-15_InterviewLabel
Current User: Justin Germain (0053i000001U5Yl)
Start time: 8/27/2020 10:37 AM
Duration: 0 seconds
How the Interview Started
Justin Germain (0053i000001U5Yl) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Lead (00Q3i000006tVy7EAE)
myVariable_current = Lead (00Q3i000006tVy7EAE)
DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions: 
{!myVariable_current.Last_Outreach_Sequence__c} (Insight: Consulting) Equals Kogni: GRC

Default outcome executed.
DECISION: myDecision2
Skipped this outcome because its conditions weren't met: myRule_3
Outcome conditions: 
{!myVariable_current.Last_Outreach_Sequence__c} (Insight: Consulting) Equals Kogni: InfoSec

Default outcome executed.
DECISION: myDecision4
Outcome executed: myRule_5
Outcome conditions: 
{!myVariable_current.Last_Outreach_Sequence__c} (Insight: Consulting) Equals Insight: Consulting
CREATE RECORDS: myRule_5_A1
Create one CampaignMember record where:
CampaignId = 7013i000000cgf8AAA
LeadId = {!myVariable_current.Id} (00Q3i000006tVy7EAE)
Status = Sent
Result
Failed to create record.

Any ideas?
Best Answer chosen by Justin Germain
Shane CareyShane Carey
Hi Justin,

Have you tried updating your criteria to only evaluate if the field has been updated to meet criteria:

User-added image

This way if a lead is modified, but the field already equaled "Kogni: GRC" before the update, the action won't fire and it won't try to add them to a campaign they already belong to. If it's a new lead, and that field is populated, it should add them to the campaign because technically the record was modified to meet criteria.

All Answers

Shane CareyShane Carey
Hi Justin,

Have you tried updating your criteria to only evaluate if the field has been updated to meet criteria:

User-added image

This way if a lead is modified, but the field already equaled "Kogni: GRC" before the update, the action won't fire and it won't try to add them to a campaign they already belong to. If it's a new lead, and that field is populated, it should add them to the campaign because technically the record was modified to meet criteria.
This was selected as the best answer
Justin GermainJustin Germain

One. Simple. Button.

Thank you so much, Shane! It is working now! :)