This blog demonstrates how to manage vehicle inventory using Einstein Copilot custom actions, powered by Apex on the backend and a chat widget frontend. By simplifying complex data retrieval with natural language queries, this approach reduces the need for custom LWC search functionality. It allows for flexible customization, supports rapid development through no-code flows, and integrates seamlessly across Salesforce, offering a powerful solution for various business use cases.
Imagine you have an inventory of diverse vehicles like LMVs, HMVs, and FVGs, and you need to quickly search for specific vehicle types. Traditionally, this would involve creating a complex search functionality using LWC and Apex. However, Salesforce's Einstein Copilot offers a streamlined solution. By leveraging custom Einstein Copilot actions, we can simplify this process and create a user-friendly chat widget accessible from any Lightning page. In this article, we'll explore how to achieve this using Apex as the backend.
Solution Installation Instructions
You can explore this package from the installed packages under setup and check for its component.
Create Apex Custom Action
- Navigate to Setup -> Einstein Copilot Actions -> New Copilot Action
- Select type as Apex
- Select Reference Action as the invocable method name from the Apex class VehiclesService.
- Set Copilot Action Label as per your use case, this label will be used to match it semantically with the text entered in the prompt window.
- Click Finish to complete the process.
Now, let's add this custom action to the Einstein Copilot.
- Navigate to setup -> Einstein Copilots -> Click Einstein Copilot --> Click Open Builder at the top right.
- From the left panel, select the Copilot Action Library tab and select the action that we created earlier.
- Click on the dropdown next to it and select Add to Copilot action. This will add your copilot action to the copilot engine rule base.
- Now, when you type the prompt “find all the vehicles of type LMV” in the Conversation Preview window, it will semantically match this prompt with the label of the Copilot Action and execute it accordingly. (Shown in the pic below)
- It will also show up the Dynamic Plan for the execution with the inputs provided and output returned as response.
We can customize these actions as per the business use case and even integrate flows if we want to go with no code approach.
Conclusion
Einstein Copilot Custom Actions with Apex mark a significant advancement in Salesforce data interaction. This approach offers:
- Intuitive Access: Natural language queries simplify complex data retrieval.
- Customization: Apex backend enables tailored actions for specific business needs.
- Versatility: Applicable across various industries and data models.
- Rapid Development: No-code options with Flow empower non-technical team members.
- Seamless Integration: Ready availability across the Salesforce platform.
Looking ahead, this technology promises to transform customer service, sales analysis, and overall CRM interactions. As AI and NLP evolve, we can anticipate more sophisticated capabilities, driving efficiency and enhancing user experience in Salesforce applications. By leveraging these tools, organizations can stay ahead in CRM technology, ultimately improving decision-making and customer satisfaction.