High Velocity Sales (HVS) is a Sales Cloud solution to speed up the sales process for inside sales teams. The basic setup of HVS is normally carried out by an admin. However, developers are often needed to implement more advanced automations. HVS includes several features, such as Sales Cadences, Einstein Lead Scoring, Email Integration, and Sales Dialer. In this blog post, we’ll cover what developers need to know about Sales Cadences, and we’ll also deep dive into how to implement common automations, with and without code.

Before starting: if you don’t know the basics about HVS, watch this 2 minute demo.

Automating inside sales workflows with Sales Cadences

A Sales Cadence is a representation of an inside sales workflow; it guides sales reps through the prospecting and opportunity nurturing processes of a sale. The steps for a sales cadence are configured with clicks in Sales Cadence Builder. For instance, this sales cadence contains a combination of emails and calls that a sales rep should make to reach out to a possible customer. We’ll use this sales cadence for this blog post examples.

Steps for a sales cadence are configured with clicks in Sales Cadence Builder

Prospects can be assigned to sales cadences. This can be done manually, or in an automated way, by calling the assignTargetToSalesCadence invocable action. Once this is done, the prospect enters into the sales cadence, and the next steps to perform become visible to the appropriate sales rep.

Prospects can be assigned to sales cadences using the assignTargetToSalesCadence invocable action

Sales Cadences data model

Under the hood, the definition of a sales cadence is stored as data in a set of new sObjects:

  • ActionCadence: created when you use the High Velocity Sales app to create a sales cadence
  • ActionCadenceStep: represents a step; if the step is a branch step, then corresponding ActionCadenceRule and ActionCadenceRuleCondition records are also created
  • ActionCadenceRule: represents the logic that a branch step uses to make decisions in your sales cadence
  • ActionCadenceRuleCondition: represents the logic for a branch step. While ActionCadenceRule represents the full logical expression, ActionCadenceRuleCondition represents each component of the expression. So if the logical expression is (A = 2) AND (B = 4), then the rule conditions would be (A=3), (B=4) and the rule is the combination of them with the AND operator.

There are two additional sObjects that keep track of the sales cadence step that a prospect is in:

  • ActionCadenceTracker: created when you assign a prospect to a sales cadence
  • ActionCadenceStepTracker: created each time the prospect moves to a new step

sObjects that keep track of the sales cadence step that a prospect is in: ActionCadenceTracker and ActionCadenceStepTracker

Those sObjects are available through the SOAP API — which means that you can also query them. At the moment, the create() operation is not available for sales cadence objects, however this is on the product roadmap and will be possible soon. This means that you can’t programmatically create them using Apex or APIs. You can only create them from Sales Cadence Builder.

To better understand the data model, let’s take a look at what happens when you add a lead to the simple email sales cadence that we saw above.

Adding a lead to the simple email sales cadence

When this is done, ActionCadenceTracker and ActionCadenceStepTracker records are created. Then we can retrieve the ActionCadenceTracker record created by executing:

SELECT ActionCadence.Name, Target.Name, CurrentStep.StepTitle, LastCompletedStep.StepTitle, State, RelatedToId FROM ActionCadenceTracker

This is what you’ll obtain:

ActionCadence.Name Target.Name CurrentStep.StepTitle LastCompletedStep.Title State
Simple Email Cadence Robert Janzen Intro Email Running

Similarly, we can take a look at the ActionCadenceStepTracker record that has been created:

SELECT ActionCadenceName, Target.Name, StepTitle, DueDateTime, IsActionTaken, ActionTakenDatetime, State from ActionCadenceStepTracker

ActionCadenceName Target.Name StepTitle DueDateTime IsActionTaken IsActionTakenDateTime State
Simple Email Cadence Robert Janzen Intro Email 2021-08-31T21:59:59.000+0000 FALSE Active

Calling HVS invocable actions

Basic automations can be implemented using clicks. HVS has the following list of invocable actions that you can invoke from places, such as Flow, Process Builder, the REST API (as we do in this example), or Apex (as we do here), to implement your automations:

  • assignTargetToSalesCadence
  • removeTargetFromSalesCadence
  • pauseSalesCadenceTracker
  • resumeSalesCadenceTracker
  • changeSalesCadenceTargetAssignee
  • modifyCadenceTrackerAttributes
  • sendSalesCadenceEvent

Note that calling invocable actions from Apex can be simplified using this developer preview feature in Winter ‘22.

Take a look at a more detailed definition of the available actions in the HVS Invocable Actions guide.

Working with Action Cadence Tracker changes

As mentioned earlier, for more advanced automations, you’ll need to write code. A common automation use case is to be able to react to ActionCadenceTracker changes to execute an action based on certain conditions. For instance, change the lead status to “Working” when the ActionCadenceTracker is first created or to “‘Closed” when it gets completed. One limitation that exists as of today is that you can not create triggers for ActionCadenceTracker and ActionCadenceStepTracker. However, Change Data Capture (CDC) can be used to build automation. First, you’ll have to activate CDC for the ActionCadenceTracker object:

Change Data Capture (CDC) can be used to build automation

Then, you can listen to CDC events in Apex, creating an Async Apex Trigger. For instance, let’s implement an automation that changes a lead status to “Working” when it is added to a sales cadence:

Unfortunately, listening to CDC events in Flow or Process Builder is not possible. You’ll have to create an Async Apex Trigger that transforms the CDC event into a custom platform event, and then listen to the custom platform event.

For instance, let’s say the custom platform event is called SalesCadenceTrackerEvent__e. This is how you would implement the CDC trigger:

Note that the code above only throws the event when the cadence tracker is first created or when it gets completed (state = Complete). Then, those newly created SalesCadenceTrackerEvent__e can be detected from Flow or Process Builder to implement the desired automations.

Here, you have a diagram that represents one of the possible flows in this automation:

Example of a possible flow in the automation sequence

If you want to know more, take a look at this document that contains detailed instructions on how to implement this automation.

Working with ActionCadenceStepTracker changes

Similarly, if you want to react to ActionCadenceStepTracker changes, you’ll have to use CDC. You can then listen to CDC events from a trigger and implement the required automations with code (as we do in this example). Alternatively, you can convert the CDC event to a custom platform event, same as we did with Action Cadence Tracker. Here you have the code to do so:

Note that the code above only throws the event when the cadence step tracker is first created (state = Active) or when it gets completed (state = Completed).

Here you have another diagram that represents one of the possible flows in this automation:

Additional example of possible flow for automation

Take a look at this other document to read detailed instructions on implementing this automation.

Next steps

In this blog post, we’ve covered the most important points to successfully implement automations for Sales Cadences in High Velocity Sales.

If you want to check more examples, take a look at this documentation page in which some more automation ideas are explained. We’ve also uploaded all the code examples to this GitHub repo, for an easier consumption.

Finally, I recommend tackling this Trailhead trail, in which you’ll be able to learn the most important functional HVS concepts to rock your implementations.

About the author

Alba Rivas works as a Principal Developer Advocate at Salesforce. She focuses on Lightning Web Components and Lightning adoption strategy. You can follow her on Twitter @AlbaSFDC.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS