A pre-built example of a Lightning Flow utilizing Coveo Customer Service capabilities in order to:
- Predict case classification values depending on the case description given by the customer.
- Suggest documents that can potentially solve the customer's case before it is created.
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 working deployment of a Case Assist Configuration to provide Document Suggestions as well as Case Classifications.
-
How to deploy: This is the recommended installation option. Use this option if you want to experience the app and the code.
-
Installing the app using an Unlocked Package: This option allows anybody to experience the sample app without installing a local development environment.
-
Description of Files and Directories: A description of all the content of this repository.
- A lightning flow already setup with multiple steps to create a support case.
- A first screen where the user can enter a Subject and a Description for their case. This screen will predict values for the
Case Reason
field as it is a Standard Salesforce Case field. - A second screen where documentation will be suggested to the customer based on the text entered in the case Subject and Description.
- A final screen where the customer can review their case information if they were not able to solve it.
- A confirmation screen that the case was created.
-
Install npmjs
-
Run the setup tasks
npm install
npm run build
-
Follow the steps 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).
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 Org Development Model with VS Code. For details about the model, see the Org Development Model Trailhead module.
When working with non-source-tracked orgs, use the commands SFDX: Deploy Source to Org
(VS Code) or sfdx force:source:deploy
(Salesforce CLI) and SFDX: Retrieve Source from Org
(VS Code) or sfdx force:source:retrieve
(Salesforce CLI). The Push
and Pull
commands work only on orgs with source tracking (scratch orgs).
When working with source-tracked orgs, use the commands SFDX: Push Source to Org
(VS Code) or sfdx force:source:push
(Salesforce CLI) and SFDX: Pull Source from Org
(VS Code) or sfdx force:source:pull
(Salesforce CLI). Do not use the Retrieve
and Deploy
commands with scratch orgs.
TBD
- In the class CaseAssistEndpoint. Change this line to add your case assist ID:
public static final String CASE_ASSIST_ID = 'YOUR_CASE_ASSIST_ID';
- In your Salesforce community, drag the Lightning Flow component onto a Community page and select the Case_Assist_Demo_Flow shipped with this repository.
- In the published version of your community, fill in the subject and description fields (minimum of 10 characters in the description) in the first screen to see the Related Category section appear and get predictions for the Case Reason field.
Make sure you drag and drop the component AnalyticsBeacon somewhere in your community in order for the Case Flow to send analytics events. We recommend dropping it in your community header or footer region (It is invisible to the end user).
If you do not have it you will see that error in the console : Analytics Beacon cannot be found, include the component in your page to send events.
.
- Run
npm i
- Run
npm run build
- Run
npm run test
- Now you can deploy with
sfdx force:source:deploy...
Unfortunately since this example is meant to be included in a flow, it has trouble running on the local dev server: https://developer.salesforce.com/docs/component-library/documentation/lwc/get_started_local_dev_setup
You can run the included tests:
npm run:test:watch
This cookbook uses the coveo.analytics.js library in order to track user interactions with the different components.
It is included as a dependency in this project and served via a static resource within the different components of this repository.