NextBestAction Class

Execute recommendation strategies, get recommendations, manage recommendation reactions.

Namespace

ConnectApi

NextBestAction Methods

The following are methods for NextBestAction. All methods are static.

deleteRecommendationReaction(reactionId)

Delete a recommendation reaction.

API Version

45.0

Requires Chatter

No

Signature

public static Void deleteRecommendationReaction(String reactionId)

Parameters

reactionId
Type: String
ID of the recommendation reaction.

Return Value

Type: Void

Usage

Users with the Manage Next Best Action Recommendations or Modify All Data permission can delete recommendation reactions.

executeStrategy(strategyName, maxResults, contextRecordId)

Execute a strategy.

API Version

45.0

Available to Guest Users

45.0

Requires Chatter

No

Signature

public static ConnectApi.NBARecommendations executeStrategy(String strategyName, Integer maxResults, String contextRecordId)

Parameters

strategyName
Type: String
Name of the strategy.
maxResults
Type: Integer
Maximum number of results. Valid values are from 1 to 25. The default is 3.
contextRecordId
Type: String
ID of the context record. For example, if the next best action is on a case detail page, the ID of the case.

Return Value

Type: ConnectApi.NBARecommendations

executeStrategy(strategyName, maxResults, contextRecordId, debugTrace)

Execute a strategy and request a trace.

API Version

45.0

Available to Guest Users

45.0

Requires Chatter

No

Signature

public static ConnectApi.NBARecommendations executeStrategy(String strategyName, Integer maxResults, String contextRecordId, Boolean debugTrace)

Parameters

strategyName
Type: String
Name of the strategy.
maxResults
Type: Integer
Maximum number of results. Valid values are from 1 to 25. The default is 3.
contextRecordId
Type: String
ID of the context record. For example, if the next best action is on a case detail page, the ID of the case.
debugTrace
Type: Boolean
Specifies whether to return trace and debug information in the response (true) or not (false).

Return Value

Type: ConnectApi.NBARecommendations

executeStrategy(strategyName, strategyInput)

Execute a strategy using an input class.

API Version

45.0

Available to Guest Users

45.0

Requires Chatter

No

Signature

public static ConnectApi.NBARecommendations executeStrategy(String strategyName, ConnectApi.NBAStrategyInput strategyInput)

Parameters

strategyName
Type: String
Name of the strategy.
strategyInput
Type: ConnectApi.NBAStrategyInput
A ConnectApi.NBAStrategyInput body.

Return Value

Type: ConnectApi.NBARecommendations

getRecommendation(recommendationId)

Get a recommendation.

API Version

45.0

Requires Chatter

No

Signature

public static ConnectApi.Recommendation getRecommendation(String recommendationId)

Parameters

recommendationId
Type: String
ID of the recommendation.

Return Value

Type: ConnectApi.Recommendation

getRecommendationReaction(reactionId)

Get a recommendation reaction.

API Version

45.0

Requires Chatter

No

Signature

public static ConnectApi.RecommendationReaction getRecommendationReaction(String reactionId)

Parameters

reactionId
Type: String
ID of the recommendation reaction.

Usage

Users with the Manage Next Best Action Recommendations or Modify All Data permission can get recommendation reactions.

getRecommendationReactions(onBehalfOfId, createdById, targetId, contextRecordId, pageParam, pageSize)

Get recommendation reactions.

API Version

45.0

Requires Chatter

No

Signature

public static ConnectApi.RecommendationReactions getRecommendationReactions(String onBehalfOfId, String createdById, String targetId, String contextRecordId, Integer pageParam, Integer pageSize)

Parameters

onBehalfOfId
Type: String
Use the ID of the user who is indirectly reacting to the recommendation to filter the results.
createdById
Type: String
Use the ID of the user or record that created the recommendation reaction to filter the results.
targetId
Type: String
Use the ID of the target to filter the results.
contextRecordId
Type: String
Use the ID of a context record to filter the results.
pageParam
Type: Integer
Specifies the number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.
pageSize
Type: Integer
Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

Usage

Users with the Manage Next Best Action Recommendations or Modify All Data permission can get recommendation reactions.

setRecommendationReaction(reaction)

Record user reactions to recommendations.

API Version

45.0

Available to Guest Users

48.0

Requires Chatter

No

Signature

public static ConnectApi.RecommendationReaction setRecommendationReaction(ConnectApi.RecommendationReactionInput reaction)

Parameters

reaction
Type: ConnectApi.RecommendationReactionInput
A ConnectApi.RecommendationReactionInput object representing a reaction to a recommendation produced by a recommendation strategy.