Never Miss a Beat: Notifications for Prospect Removal in Sales Engagement Cadence

Advertisements

Last Updated on November 1, 2023 by Rakesh Gupta

Big Idea or Enduring Question:

  • How do you notify the lead owner when someone removes a lead from the Sales Engagement Cadence?

Objectives:

After reading this blog, you’ll be able to:

  • Understand the Change Data Capture
  • Understand ActionCadenceTracker object 
  • Subscribe to Change Events Using an Apex Trigger
  • Call an Autolaunched Flow from Apex Class
  • And much more.

👉 Previously, I’ve penned an article on Sales Engagement. Why not check them out while you are at it?!

  1. Have You Traversed the Yellow Brick Road of Sales Cadence, Yet?

Business Use case

Benjamin Moore, a Salesforce Administrator at Gurukul On Cloud (GoC), has been assigned a specific task. Whenever a telemarketer or the Inside sales team removes a lead (prospect) from the sales engagement cadence, ensure the automatic creation of a task with these details:

  • Subject:- Prospect removed from Sales Engagement Cadence 
  • Status:- Not Started
  • Priority:- High
  • Due Date:- Today
  • Related To:- Lead
  • Assigned To:- Lead Owner

What is Sales Engagement Cadence?

Acquiring leads is an important step in any marketing effort. Once Inside Sales Teams have a list of leads, they are ready to undertake outreach. But, wait! Let us take a step back and ponder following questions as a preamble to understanding Sales Cadence: (1) How often do you want your reps to reach out to leads? (2) How would you like them to reach out to lead – using call or email? (2) How do you want to capture call disposition? (3) etcetera.

Sales engagement cadence is a timeline of sales activities and methods that sales reps follow to engage leads. The purpose of a cadence is to make it easy for the Inside Sales Rep to stay on schedule and ensure that prospects aren’t forgotten – i.e., nothing falls through the cracks. For example, if you offer a free consultation on your website and someone fills out a form, the cadence would include a list of things you do to schedule the first meeting.

A Sales Cadence typically includes three different touchpoints: EmailSocial Media and, Calls/Voicemails. A cadence, for different sales funnel, may differ but, it should always include a combination of the mentioned three forms of communications.

A Sales engagement Cadence looks something like this:

HVS.png

In other words, Sales Engagement Cadences differ from one type of sales process to the next, but the basic idea remains the same: consistent, sequential touches.

What is Change Data Capture?

9 thoughts on “Never Miss a Beat: Notifications for Prospect Removal in Sales Engagement Cadence

  1. Thank you. Im struggling with writing the test class for the trigger ActionCadenceTrackerChangeTrigger on ActionCadenceTrackerChangeEvent… I need it for deployment. how to test a platform event efficiently ? thank you

  2. hey Rakesh,
    in my flow im trying to create an opportunity related to the target passed from __e to Flow… all other DMLs are fine except for Opp creation… FLOW_ELEMENT_ERROR|Operation not valid for this user type
    Any Idea why Im having this error and how to fix it ?

    1. It seems like you’re trying to assign an inactive user or a user with a Chatter Free license to an opportunity.

  3. trigger ActionCadenceTrackerChangeTrigger on ActionCadenceTrackerChangeEvent (after insert) {
    Set trackerIds = new Set();
    for (ActionCadenceTrackerChangeEvent event : Trigger.new) {
    EventBus.ChangeEventHeader header = event.ChangeEventHeader;
    trackerIds.add(header.recordIds[0]);
    }

    Map trackerMap = new Map(
    [SELECT Id, ActionCadenceId, TargetId FROM ActionCadenceTracker WHERE Id IN :trackerIds]
    );

    List eventsToPublish = new List();

    Set triggerDispositions = new Set{
    ‘Opportunity Generated’,
    ‘Customer Connected’,
    ‘Future Prospect’,
    ‘Completed Cadence’,
    ‘Not Interested’,
    ‘Not Decision Maker’,
    ‘No Longer at Company’,
    ‘Do Not Call’,
    ‘Email Opt Out’,
    ‘Do Not Solicit’,
    ‘Invalid Email’
    };

    for (ActionCadenceTrackerChangeEvent event : Trigger.new) {
    EventBus.ChangeEventHeader header = event.ChangeEventHeader;
    ActionCadenceTracker tracker = trackerMap.get(header.recordIds[0]);

    if (tracker != null && triggerDispositions.contains(event.CompletionDisposition) && ‘Complete’.equalsIgnoreCase(event.State)) {
    CadencetrackerEvent__e newEvent = new CadencetrackerEvent__e(
    TargetId__c = tracker.TargetId,
    State__c = event.State,
    CompletionDisposition__c = event.CompletionDisposition,
    CadenceId__c = tracker.ActionCadenceId,
    RelatedToId__c = tracker.Id
    );
    eventsToPublish.add(newEvent);
    }
    }

    if (!eventsToPublish.isEmpty()) {
    try {
    EventBus.publish(eventsToPublish);
    } catch (Exception e) {
    System.debug(‘Error publishing events: ‘ + e.getMessage());
    }
    }
    }

    I dont know how to add screenshots. sorry!! I managed to have the flow do the fields updates for now, but I noticed that sometimes the target does not get removed from he cadence( i have a remove target from cadence element that removes the passed targetid from all associated cadences)

    Also I have attached my trigger that publishes the platform event, and I’m struggling to write a test class for it for deployment.

    I really appreciate your time and help Sir.

    1. I am happy to help. Feel free to send me your test class.

  4. It’s an interesting article for those working with Salesforce and sales. It demonstrates how Change Data Capture can automate notification and task creation when leads are removed from a sales cadence. It can be useful for enhancing lead tracking.

    1. Your Welcome, glad you enjoyed it 🙂

    2. Can you please share the screenshot of your flow? I am happy to help.

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Automation Champion

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%