QuestionAndAnswers Class

Access question and answers suggestions.

ConnectApi

These methods are for QuestionAndAnswers. All methods are static.

All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.

Get question and answers suggestions.

32.0

Yes

public static ConnectApi.QuestionAndAnswersSuggestions getSuggestions(String communityId, String q, String subjectId, Boolean includeArticles, Integer maxResults)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.

subjectId

Type: String

Specify a subject ID to search only questions on that object. If the ID is a topic or a user, the ID is ignored.

includeArticles

Type: Boolean

Specify true to include knowledge articles in the search results. To return only questions, specify false.

maxResults

Type: Integer

The maximum number of results to return for each type of item. Possible values are 1–10. The default value is 5.

Type: ConnectApi.QuestionAndAnswersSuggestions

To test code that uses this method, use the matching set test method (prefix the method name with setTest). Use the set test method with the same parameters or the code throws an exception.

See Also

Register a ConnectApi.QuestionAndAnswersSuggestions object to be returned when getSuggestions is called with matching parameters in a test context. Use the method with the same parameters or the code throws an exception.

32.0

public static Void setTestGetSuggestions(String communityId, String q, String subjectId, Boolean includeArticles, Integer maxResults, ConnectApi.QuestionAndAnswersSuggestions result)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

q

Type: String

Required and can’t be null. Specifies the string to search. The search string must contain at least two characters, not including wildcards. See Wildcards.

subjectId

Type: String

Specify a subject ID to search only questions on that object. If the ID is a topic or a user, the ID is ignored.

includeArticles

Type: Boolean

Specify true to include knowledge articles in the search results. To return only questions, specify false.

maxResults

Type: Integer

The maximum number of results to return for each type of item. Possible values are 1–10. The default value is 5.

result

Type: ConnectApi.QuestionAndAnswersSuggestions

Object containing test data.

Type: Void

See Also

Choose or change the best answer for a question.

32.0

Yes

public static ConnectApi.QuestionAndAnswersCapability updateQuestionAndAnswers(String communityId, String feedElementId, ConnectApi.QuestionAndAnswersCapabilityInput questionAndAnswersCapability)

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

feedElementId

Type: String

ID of the feed element.

questionAndAnswersCapability

Type: ConnectApi.QuestionAndAnswersCapabilityInput

Specify the best answer (comment ID) for the question.

Type: ConnectApi.QuestionAndAnswersCapability

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.