Skip to content

A pre-built example of a Lightning Flow utilizing Coveo Case Assist

License

Notifications You must be signed in to change notification settings

coveooss/sf-case-assist-cookbook

Repository files navigation

Case Assist Flow cookbook

A pre-built example of a Lightning Flow utilizing the Coveo Quantic Case Assist components in order to:

  1. Predict case classification values depending on the case Subject and Description given by the customer.
  2. Suggest documents that can potentially solve the customer's case before it is created.
  3. Track user interactions with the different components and screens across the entire case assist flow through Coveo Analytics and Reports.

It is distributed as an example of best practices when requesting field predictions and document suggestions from the Coveo Customer Service API.

It requires an active Coveo organization with indexed Salesforce Cases in order to provide field predictions.

It requires a Case Assist Configuration to provide Document Suggestions as well as Case Classifications.

Table of Contents

What Is Included in This Project

This project contains two flows: a Recommended Flow and a Demo flow. Both are lightning flows already setup with multiple steps to create a support case.

Recommended Flow:

The Recommended Flow contains the following screens:

  1. A first screen where the user can enter a Subject and a Description for their case and can see the strength of this Description using the Description Strength Indicator.
  2. A second screen where the user can find predictions to help classify their case. This screen will predict values for the Case Priority, Case Type, and Case Reason fields as these are Standard Salesforce Case fields. See How to Add New Fields for Classification section to learn how to modify these.
  3. A third screen where documents will be suggested to the user based on the text entered in the case Subject and Description. The user can read more about each document suggestion with the help of the Quickview and can also leave their feedback on each document.
  4. A confirmation screen that the case has been successfully created.

Here is a demo video of this flow in action: Demo of the new Coveo Case Assist Experience.

Demo Flow:

The Demo Flow contains the following screens:

  1. A first screen where the user can enter a Subject and a Description for their case and can see the strength of this Description, using the Description Strength Indicator, as well as the predictions to help classify their case. The user can see the predictions for the Case Priority, Case Type, and Case Reason fields as they type in the Subject and Description inputs. See How to Add New Fields for Classification section to learn how to modify these.
  2. A second screen where documents will be suggested to the user based on the text entered in the case Subject and Description. The user can read more about each document suggestion with the help of the Quickview and can also leave their feedback on each document.
  3. A confirmation screen that the case has been successfully created.

PS: A Login screen is implemented in both flows. It's just a template that you can use to provide a custom login screen to access the case assist flow.

How to Deploy

1. Set up Your Environment

  • Install npmjs

  • Run the setup tasks

npm install
  • Follow the steps to set up your development environment for example in the Quick Start: Lightning Web Components Trailhead project. You will:

    • Enable Dev Hub in your Trailhead Playground
    • Install Salesforce CLI
    • Install Visual Studio Code
    • Install the Visual Studio Code Salesforce extensions, including the Lightning Web Components extension

These steps assume you already have the Coveo for Salesforce package installed and configured (linked to a Coveo organization).

2. Install the Quantic Library

Install the Coveo Quantic Library as a Salesforce unlocked package.

3. Deploying the Project

3a. Deploy the Project Using the Org Development Model

The Org Development Model allows you to connect directly to a non-source-tracked org (sandbox, Developer Edition (DE) org, Trailhead Playground, or even a production org) to retrieve and deploy code directly. This model is similar to the type of development you have done in the past using tools such as Force.com IDE or MavensMate.

To start developing with this model in Visual Studio Code, see Visual Studio Code for Salesforce Development. For details about the model, see the Org Development Model Trailhead module.

sfdx force:source:deploy

3b. Deploy the project in a Scratch Org

Use the command SFDX: Push Source to Org in VS Code or type the following SFDX command in your CLI:

sfdx force:source:push

3c. Install the App Using an Unlocked Package

Type the following SFDX command in your CLI:

sfdx force:package:install --package 04t3s000003X61EAAS -u <USER_NAME>

Where you replace <USER_NAME> by your username in the target organization.

4. Enable the Case Flow in Your Community

  1. In your Salesforce community, drag the Lightning Flow component in a Community page, and then select the Case_Assist_Recommended_Flow or the Case_Assist_Demo_Flow shipped with this repository.
  2. After selecting the name of the flow, you must fill the caseAssistId and engineId fields.
    1. In the caseAssistId field, enter your Case Assist Id, retrieved from your Case Assist Configuration.
    2. In the engineId field, enter your Engine Id, which is the name you want to give to the engine instance the Quantic components will register to.
    3. Leave the caseData field blank.
  3. After linking your installed Coveo for Salesforce package to a Coveo organization, make sure to go change the content of the Apex class CaseAssistController. By default it will try to query a sample organization. Replace this method with the commented method just below it to generate a Platform token and query your selected Coveo organization.
  4. In the published version of your community, users can now fill in the Subject and Description fields on the first screen. They can then proceed to the next screens to view the predicted classification values for their case, and get document suggestions to help them potentially resolve their case before submitting it.

Dev, Build and Test

  1. Run npm i
  2. Run npm run test
  3. Now you can deploy with sfdx force:source:deploy...

Warning

This cookbook was originally designed to be used with an API key, which would only grant you access to Coveo results that were "public".

You can also use this cookbook with a Platform token to use the identity of the current user to get access to content that's not necessarily only "public". Take note that using a Platform token currently breaks the Quickview functionality on Document Suggestions. Although we're actively working on a solution, this is a tradeoff you need to consider.

How to Add New Fields for Classification

This cookbook suggests classifications for the standard case fields Case Priority, Case Type, and Case Reason. To specify additional fields for classification, access the Provide Details Screen and copy the sample code that are commented out in the provideDetailsScreen.html and provideDetailsScreen.js files as many times as necessary. Remember to replace the placeholders <SALESFORCE_API_FIELD_NAME> and <COVEO_FIELD_NAME> with the Salesforce API name and the Coveo field name of the new field to predict, respectively. You can find the Coveo Field Name in the Fields section of the Coveo Admin Console.
Make sure that all newly added fields are specified in your configuration (see Configuring the Case Classification Functionality).

About

A pre-built example of a Lightning Flow utilizing Coveo Case Assist

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published