Salesforce creates a new event for existing invitees, but the lead owner doesn't update. You might want to update the lead owner to match the event owner, for example when a lead moves into a different stage of the sales cycle.
To learn more about default flow behavior, check out this article.
Update the lead owner to match the event owner
Note: If you're unsure what version you currently use, you can visit your Salesforce integrations page to confirm your version.
Locate your flow
- In Salesforce Setup, search for Flows. Select Flows.
- If you haven't customized the CreateEventTemplate before, you'll need to create a new flow based on the template. To do so, you can open the CreateEventTemplate, customize it directly, then Save as. Saving it will create a new flow. You can call the new flow something like "CreateEvent."
- If you've already customized the flows, then open your customized flow.
Add a Decision element
- From the Toolbox on the left-hand side, drag a Decision element to the far right of the flow, next to the Create Records: Create Event element.
- At New Decision, set Label to Lead Match to update.
- Under Outcome details, set the Label to Lead Match to Update Record Owner.
- Under Condition Requirements to Execute Outcome, select All Conditions Are Met. You'll set up 3 conditions.
- For the first condition:
- At Resource, select WhoRecordId.
- At Operator, select Does Not Equal.
- At Value, select $GlobalConstant.EmptyString.
- Select, + Add Condition. For the second condition:
- At Resource, select LeadConvertedAt.
- At Operator, select Is Null.
- At Value select $GlobalConstant.True.
- Select, + Add Condition. For the third condition:
- At Resource, enter WhoRecordId.
- At Operator, select Is Null.
- At Value, select $GlobalConstant.False.
- For the first condition:
- Select Done.
Add an Update Records element
- From the Toolbox on the left-hand side, drag an Update Records element to the far right of the flow next to the Decision, Lead Match to Update element.
- At New Update Records, set Label to Update Lead Owner.
- Under How to Find Records to Update and Set Their Values, select Specify conditions to identify records, and set fields individually.
- Under Update Records of This Object Type, at Object, select Lead.
- At Filter Lead Records, at Condition Requirements to Update Records, select All Conditions are Met. You'll set up a condition:
- At Field, select Id.
- At Operator, select Equals.
- At Value, select WhoRecordId.
- At Set Field Values for the Lead Records, you'll set up a field.
- At Field, select OwnerId.
- At Value, select OwnerId.
- Select Done.
Connect the elements
- Connect the Subflow: Create Event Attendee Template element to the Decision: Lead Match to update element.
- Connect the Decision: Lead Match to update element to the Update Records: Update Lead Owner element.
- For the Select Outcome for Decision Controller popup, leave the Outcome as Lead Match to Update Record Owner, and select Done.
Save and activate the flow
- Select Save As, then A New Version, then Save.
- To activate your flow, select Activate.
Note: you will also need to deactivate the CreateEventTemplate, so you don’t have duplicate events in Salesforce.
Locate your flow
- In Salesforce Setup, search for Flows. Select Flows.
- If you haven't customized the CreateEventTemplate before, you'll need to create a new flow based on the template. To do so, you can open the CreateEventTemplate, customize it directly, then Save as. Saving it will create a new flow. You can call the new flow something like "CreateEvent."
- If you've already customized the flows, then open your customized flow.
Add a Decision element
- From the Toolbox on the left-hand side, drag a Decision element to the far right of the flow, next to the Create Records: Create Event element.
- At New Decision, set Label to Lead Match to update.
- Under Outcome details, set the Label to Lead Match to Update Record Owner.
- Under Condition Requirements to Execute Outcome, select All Conditions Are Met. You'll set up 3 conditions.
- For the first condition:
- At Resource, select WhoRecordId.
- At Operator, select Does Not Equal.
- At Value, select $GlobalConstant.EmptyString.
- Select, + Add Condition. For the second condition:
- At Resource, select LeadConvertedAt.
- At Operator, select Is Null.
- At Value select $GlobalConstant.True.
- Select, + Add Condition. For the third condition:
- At Resource, enter WhoRecordId.
- At Operator, select Is Null.
- At Value, select $GlobalConstant.False.
- For the first condition:
- Select Done.
Add an Update Records element
- From the Toolbox on the left-hand side, drag an Update Records element to the far right of the flow next to the Decision, Lead Match to Update element.
- At New Update Records, set Label to Update Lead Owner.
- Under How to Find Records to Update and Set Their Values, select Specify conditions to identify records, and set fields individually.
- Under Update Records of This Object Type, at Object, select Lead.
- At Filter Lead Records, at Condition Requirements to Update Records, select All Conditions are Met. You'll set up a condition:
- At Field, select Id.
- At Operator, select Equals.
- At Value, select WhoRecordId.
- At Set Field Values for the Lead Records, you'll set up a field.
- At Field, select OwnerId.
- At Value, select OwnerId.
- Select Done.
Connect the elements
- Connect the Create Records: Create Event element to the Decision: Lead Match to update element.
- Connect the Decision: Lead Match to update element to the Update Records: Update Lead Owner element.
- For the Select Outcome for Decision Controller popup, leave the Outcome as Lead Match to Update Record Owner, and select Done.
Save and activate the flow
- Select Save As, then A New Version, then Save.
- To activate your flow, select Activate.
Note: you will also need to deactivate the CreateEventTemplate, so you don’t have duplicate events in Salesforce.
- From your Setup page, locate the Quick Find / Search box, then type flows.
- Select Flows.
- At Flows, open the CreateEvent flow.
- Note: Your organization's visual builder may be viewed in the Classic or Lightning experience. Functionality remains the same.
- From the Toolbox on the left-hand side, drag a Decision element to the far right of the flow next to the Create Records, Create Event element.
- At Edit Decision, set:
- Label to Lead Match to update
- When to Execute Outcome to All Conditions Are Met
- At Resource, enter {!WhoRecordId}. Then at Operator, select Does Not Equal. Set the Value to {!GlobalConstant.EmptyString}. Then, + Add Condition.
- At the next Resource, enter {!LeadConvertedAt}. Then at Operator, select Is Null. Set the Value to {!GlobalConstant.True}. Then, + Add Condition.
- At the last Resource, enter {!WhoRecordId}. Then at Operator, select Is Null. Set the Value to {!GlobalConstant.False}. Then select Done.
- From the Toolbox on the left-hand side, drag an Update Records element to the far right of the flow next to the Decision, Lead Match to Update element.
- At Edit Update Records, set Object to Lead.
- At Filter Lead Records, set:
- Condition Requirements to Conditions are Met
- Field to Id
- Operator to Equals
- Value to {!WhoRecordId}
- At Set Field Values for the Lead Records, set:
- Field to OwnerId
- Value to {!OwnerId}. Then select Done.
- Connect the elements.
- To save the flow, select Save, then select Save As to save the modified version of the flow. To activate the flow, select Activate.