1

How do I mark an answer as Best Answer through ConenctApi? I tried setting bestAnswerId of ConnectApi.QuestionAndAnswersCapabilityInput but it does not mark the answer as Best Answer.

ConnectApi.QuestionAndAnswersCapabilityInput questionAndAnswerCapabilitiesInput = new ConnectApi.QuestionAndAnswersCapabilityInput();
questionAndAnswerCapabilitiesInput.bestAnswerId = feedComment.Id;

Can someone help how to post the answer as Best Answer?

3

You need to use ConnectApi.QuestionAndAnswers.updateQuestionAndAnswers after this.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_ConnectAPI_QuestionAndAnswers_static_methods.htm?search_text=bookmark#apex_ConnectAPI_QuestionAndAnswers_updateQuestionAndAnswers_1

ConnectApi.QuestionAndAnswersCapability result = ConnectApi.QuestionAndAnswers.updateQuestionAndAnswers(communityId, QuestionId, bestAnswerId);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.