NextBestAction Class

Execute recommendation strategies, get recommendations, manage recommendation reactions.

ConnectApi

Community users can’t access this class. Portal and guest users can access strategies only through the Suggested Actions component.

These methods are for NextBestAction. All methods are static.

Delete a recommendation reaction.

45.0

No

public static Void deleteRecommendationReaction(String reactionId)

reactionId

Type: String

ID of the recommendation reaction or other sObject that caused the user to react.

Type: Void

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

Execute a strategy.

45.0

45.0

No

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

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.

Type: ConnectApi.NBARecommendations

Execute a strategy and request a trace.

45.0

45.0

No

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

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).

Type: ConnectApi.NBARecommendations

Execute a strategy using an input class.

45.0

45.0

No

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

strategyName

Type: String

Name of the strategy.

strategyInput

Type: ConnectApi.NBAStrategyInput

A ConnectApi.NBAStrategyInput body.

Type: ConnectApi.NBARecommendations

Get a recommendation.

45.0

No

public static ConnectApi.Recommendation getRecommendation(String recommendationId)

recommendationId

Type: String

ID of the recommendation.

Type: ConnectApi.Recommendation

Get a recommendation reaction.

45.0

No

public static ConnectApi.RecommendationReaction getRecommendationReaction(String reactionId)

reactionId

Type: String

ID of the recommendation reaction or other sObject that caused the user to react.

Type: ConnectApi.RecommendationReaction

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

Get recommendation reactions.

45.0

No

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

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

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.

Type: ConnectApi.RecommendationReactions

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

Record user reactions to recommendations.

45.0

48.0

No

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

reaction

Type: ConnectApi.RecommendationReactionInput

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

Type: ConnectApi.RecommendationReaction