Writing Einstein Copilot actions that call flows.
David Smith
Architecture Lead at GravityLab, CTO for Five To Flow, 16x Salesforce Certified
I've been having a play with Einstein Copilot and writing actions that call flows to add functionality that doesn't exist, as well as getting an idea of various issues that aren't super clearly documented.
The process I'm going to go through is adding a lead via Copilot. Out of the box this just doesn't work. Einstein copilots come with a set of existing actions, anything different you want to do you'll need to build an action for.
For this demo, I wanted to prove that I could call a flow, pass inputs, and get an output.
Here's my flow:
Pretty basic, doesn't need to be more complicated for now. You can see that I'm using variables to fill in the various fields, these are flagged as input. It's also really important to have an output variable. If you don't have this, you get a weird error that doesn't explain what's wrong, but this will go away if you have that output. In this example, I'm just passing the ID of the lead back.
Ok, so that's our flow done. Now we need to add an action. Inside the copilots actions editor, I chose the flow option, selected my flow (autolaunched only) and this is how I set my action up.
领英推è
Inside the Copilot Action instructions, I told it to expect a name, a company name and email, and to take care of splitting out the name into first and last name. From there, because I chose the flow when setting up the action, the input and output variables are exposed for use.
Once this is all mapped, I need to add it to the copilot. The other part I got stuck on here is that "add to copilot" was greyed out; you'll need to deactivate the copilot before you can add the action.
Now when I run the action, it looks like this:
I'm still working out how to craft the output instructions so that it gives me a link to the lead instead of just the ID, but that's not a major.
My initial thoughts are these:
- There's probably a market/need for general processes that aren't included out of the box to be added, whether through the AppExchange or just sharing approaches as above. It'll be interesting to see how the community responds to this, lots of opportunities for blog posts I imagine.
- There are lots of weird little bugs; error messages that make no sense, boxes that when you tick you can't untick? It's a beta, so it's not a biggie.
- Prompt builder is a whole other beast that I haven't touched on. I'll be writing up a post on the AI ecosystem inside Salesforce, I think bringing all the various parts into a single view will be useful for understanding the model at this early stage of the products lifecycle.
I'm really keen to keep working on this tool, and getting more value from it. I'm especially keen to do more on the 'Grounding' aspect, and understanding how to pass in record collections via flows so I can use it for analytics.
If you want to try this out for yourself, this trailhead gives you a demo org with Einstein installed.
Salesforce Certified Application Architect | Salesforce Developer 6X Certified
7 个月Hi David, where you able to get to showing a link in einstein copliot?