Retrieve Case Classifications using Apex
Retrieve Case Classifications using Apex
|
|
Available since
This feature was introduced in the October 2020 release of Coveo for Salesforce version 4.8. |
Prerequisite
You must have a valid Case Assist ID.
Retrieving Case Classifications
-
In Salesforce, access the Developer Console.
-
Instantiate the
CaseAssistApiClientas follows:String caseAssistId = '00000000-0000-0000-0000-000000000000'; Boolean debug = false; CoveoV2.CaseAssistApiClient client = CoveoV2.CaseAssistApiClient.getClient(caseAssistId, debug);NoteThe
debugparameter is optional. It indicates whether to include an execution report for debugging purposes. The default value isfalse. -
Invoke the
getCaseClassificationsmethod to retrieve the case classifications.ExampleMap<String, Object> classifications = client.getCaseClassifications(new Map<String, Object> { 'clientId' => '56f994be-320d-4c06-ab8e-f7c312d517ff', 'fields' => new Map<String, Object> { 'subject' => new Map<String, Object> {'value' => 'The case subject'}, 'description' => new Map<String, Object> {'value' => 'The case description'} } });The
getCaseClassificationsmethod takes aMap<String, Object>as an input. -
Specify values for the following arguments:
-
clientIDidentifies a specific instance of a browser client and provides insights into the events performed by the user. -
fieldsrepresents the fields of the current case that are considered meaningful for providing relevant case classifications. Thesubjectanddescriptionfields are used to retrieve matching case classifications.Notes-
More fields can be added to better suit the use case.
-
The field values should be read from the current case and passed as a
Map<String, Object>with avaluekey.
-
The result is a
Map<String, Object>, which contains suggested values for the fields configured in the Case Classification configuration.ExampleMap<String, Object> fields = (Map<String, Object>)classifications.get('fields');You’re now ready to retrieve and use case classifications in your own application.
-