Make Sales Teams More Productive with NBA
Good Morning, Salesperson demonstrates how NBA can feed high priority targets to salespeople and let their managers easily configure the prioritization.
To start with, we define different Sales Tactics. A Tactic is a prioritization of the target records, which could be Leads, Opportunities, or something else. In our example, we’ve defined four different tactics:
- Einstein Score
- Proximity to Expiration
- Opportunity Value
- Sector Focus
The order of these determines which recommendations will be shown to salespeople. For example, given these opportunities:
If Proximity to Expiration is the current prioritization, then Opportunity A will be the highest priority opportunity, because it has only 6 days until the current contract it’s associated with expires. However, if Opportunity Value is the current prioritization, then Opportunity D will be the highest priority, because it has the highest Value.
Based on the prioritization, Salespeople will see ordered recommendations on their User page:

The lightning component shown above is a custom lightning component that delivers functionality similar to the standard Next Best Action component: it takes a series of recommendations and displays them, allowing the user to accept or reject them. This will then cause an associated Flow to run.
The prioritizations can be made and changed freely by the desired authority. In our example, Ricky’s manager Blake is authorized to create and modify this information. The prioritization data is stored in a simple custom object called a SalesTacticalPlan:

[Andrii: Note that this particular record doesn’t perfectly match our Opportunity example. The repo contains support for two different use cases. one is about Opportunities and the other is about Insurance policies. The image above and some of the stuff in the repo is tuned for the Policy example, but this blog post will actually use the more general Opportunity example. I will clean this stuff up where necessary]
The Tactical Ordering field is used by the Next Best Action strategy to query, filter and sort the relevant records, returning the important priorities.
Sales Managers don’t have to manually edit the Sales Tactical Plan record for their team, however. Instead, they run the Manage Tactical Priorities flow, which provides them with a friendly UI. Their changes then get updated into the appropriate SaleTacticalPlan record.

SalesTacticalPlans have a Manager field which is a lookup to a User. A user who has access to Manage Tactical Priorities can create a Sales Tactical Plan for their team. It has a Lookup to Manager.
In addition, the manager can create User-specific tactical plans. To do that they use a Lookup in the Manage Tactical Priorities Flow to select a User. The Sales Tactical Plan that gets created has an additional Lookup to User field called Plan User. A User-specific plan will take precedence over a Team plan.
Running the Strategy
When a User page is loaded we either run the Manage Tactical Priorities flow or the Display Recommendations flow. (right now this is handled by conditional visibility on the User page layout in a very crude demo way).
The Display Recommendations flow uses the Execute NBA Strategy action to run the strategy, and then hands the results to the Display NBA Recommendations screen component:

The tactics are implemented in an Apex Class called Generate Tactical Recommendations. It is called once by each tactic. It dynamically generates recommendations and stamps an order number on them based on their order in the Tactical_Ordering__c field in the Tactical Plan. A Sort node then sorts the recommendations based on that ordering. Then the recommendations are deduped with the Enhance element and another Apex Class called Mark Duplicates. Finally, the relevants fields are passed to the Flow.
