Blog

Custom Apex Action on Einstein Copilot in Salesforce

Do you know about Custom Apex Action on Einstein Copilot in Salesforce?

Standard Actions :

Salesforce has some built-in events, known as standard actions. The advantage of having standard actions by default is that your copilot will be ready to assist users with numerous common Salesforce operations as soon as you activate Einstein Copilot. Below are the standard actions

  • Summarize records
  • Draft or revise Sales Emails
  • Identify Object by Name
  • Query records/ Query record with Aggregate Data
  • Provide information from the Knowledge Base

Custom Actions :

You may also develop custom actions to offer your copilot extra abilities, allowing it to assist with duties unique to your organization. Access to a copilot custom action is determined by how it is constructed. The Custom actions that are supported are

  • Apex
  • Flow
  • Prompt Template

We can able to build the custom logic on Apex and Flows based on the business requirement.

Custom Apex Action on Einstein Copilot

Let’s consider a business scenario to send out the welcome email that needs to be sent manually by the admin to the employee to successfully get login access on Salesforce.

Step 1: Write an Invocable apex method which will send the Wishes Email to the Contact record which matches with input from the user.

Step 2: Setup → Einstein → Einstein Copilot Actions → New Copilot Actions

Step 3: Select Apex Action type with Invocable method name and provide the Copilot Action Label.

Step 4:

  • You should effectively provide the Copilot Action Instructions as the AI will identify the Action based on the instruction provided by the User.
  • As the Invocable method has a parameter to be passed, the custom action creation module will automatically detect it and show it here.
  • Select the Checkboxes per the need to relate with input and output variables.

Send Wishes Email Custom Copilot Action

Demo Images:

The AI Assistant will automatically identify the name of the contact if we have provided the instruction properly otherwise, it will ask for input.

Note:

  • Custom Einstein Copilot Actions need to be added to Copilot Builder to make it available for users.
  • Einstein Copilot should be Inactive to add the custom Copilot actions