How I Solved It with Jen Lee and Katie Villanueva

Harness the Power of AI, Flow, and Slack to Summarize and Notify Users | How I Solved It

By

Welcome to another “How I Solved It.” In this series, we do a deep dive into a specific business problem and share how one Awesome Admin chose to solve it. Once you learn how they solved their specific problem, you’ll be inspired to try their solution yourself! Learn how Katie Villanueva combines Flow, Prompt Builder, and Slack to get her team the information they need in an automated, concise, and structured manner that elicits excitement and moves the business process forward.


Key business problem

I work for a small consultancy. We are a tight-knit crew but, like many companies, sometimes we go too fast. We can get caught up in the hustle and bustle of making sure the business is moving forward. There’s a fine line between fast and efficient—and fast isn’t always efficient. It’s easy to lose key information with fast communicative transactions, and sometimes there’s also an impersonal quality to them. It’s important to be concise and exercise brevity, but how do we do that effectively and not drop essential information?

We were hiring talent quickly, which is great, but we tripped up when other departments weren’t aware when we had a few new hires. When team members looked for information on the most recent new hire, they spent an exhaustive amount of time searching for information, asking questions like, “What was that person’s name?”, “Was it on Chatter, Slack, or email?”, and “Where did I put that email with the announcement?” Also, business processes broke down because we weren’t sure if the talent was fully onboarded and ready to receive work. When we interview a prospect, we gather a lot of detailed information on them so that we can share what project experience they have, roles they’re used to filling, projects they’ve worked on, etc. But not all team members need to know every detail. We were over-communicating at times and sometimes under-communicating through siloed emails and water cooler talk.

How do we keep up with the fast pace of business, and communicate in real time and with a consistent framework across the company?

Here’s how I solved it

We had a lightbulb moment when we realized we had all the ingredients to build a solution. We just had to put them together. Enter Prompt Builder, Flow, and Slack! I think there are many of us in the ecosystem who are in the early stages of adopting new Salesforce products like Prompt Builder and Copilot. In this new era of technology, it’s time to start challenging ourselves and think creatively about how we can leverage them to our advantage. We’ve got to ask ourselves, “Is this a use case where I can apply artificial intelligence (AI)?” And that’s exactly what I did.

So, how did I solve it? Knowing that AI will help me summarize the bulky information that needs to be communicated, I wondered how I could marry that with the Salesforce Platform. Let’s see... Real-time anything means Flow to me. I also need a tool that communicates to all team members, that’s in one spot, where I can look through past announcements. Slack.

Simply put: When you combine all the ingredients together, you get a flow that will automatically post to Slack using generative AI to summarize your Salesforce data.

Let’s talk about how I created the solution

How it works

A record-triggered flow fires upon contact creation. It takes all the contact information and posts key details to Slack. If there’s a biography provided on the expert, the contact record runs through Prompt Builder. Using the Field Generation template, Prompt Builder is instructed to report on custom fields such as an individual’s clouds and features knowledge, certifications, and industry experience. It will note their location and summarize a biography provided by the recruiters, hitting on key details including years of experience, projects they’ve worked on, and the value they bring to the team. Once that’s complete, the Prompt Builder response is posted to a company-wide Slack channel that communicates the expert has been onboarded and is ready to be put on a project. All communications are searchable, stored in one place.

Record-triggered flow created for solution.

Create a Slack channel

First, you’ll want to create a Slack channel for your designated recipients. For us, we want to invite our tech team, human resources (HR), and our customer success team. That way, HR can monitor onboarding communications, the tech team knows the expert is ready for work, and the customer success team is aware of the new talent and what skills they can bring to customers. It also allows team members to give the new hire a warm welcome! We’ll go ahead and call this new channel “personnel-announcements”.

Build a record-triggered flow

Next, build a record-triggered flow on the Contact object when a record is created. We don’t want any condition requirements because we want this to run every time a contact is created. We’ll have to set it up for Actions and Related Records to create the posts, since we’re not doing any field updates.

Start configuration setup for the record-triggered flow.

Configure scheduled paths

Since we’re posting to Slack, a record-triggered flow can’t execute actions that make external callouts in a path that runs immediately; so, we’re required to use a scheduled path which we’ll label “Slack Post Path”. We want the Slack post to be made in real time, without delay, so we’ll set the Offset Number to “0” and the Offset Options to “Minutes After”.

Configure Scheduled Paths setup.

Create a Decision element

Next, we need a Decision element. Why? Remember when I said that if a recruiter has a biography on the new hire, it will be posted? Ifs are indicators that a Decision element needs to be used in a flow. Our Decision element needs to decide if there’s a biography that will need to be summarized by Prompt Builder or not. We do that with Conditional Requirements in the Outcome Details section of the Decision element. I’m going to label my paths as Full Post and Short Post; the default path will be ‘Do Nothing’.

The Full Post will include a biography on the contact record; so, we ask if the triggering contact record’s Expert Bio field is null, which means does this field not have any data. We want False, it is not null. We also need to weed out the experts from customer contacts, so we include Record Type Name equals “Expert”. Note: I didn’t reference the Record Type ID here as it’s not best practice to hard code IDs in our flows.

Decision element Full Post setup.

Short Post will be similar, but opposite. We still want to single out experts, so Record Type Name equals “Expert”, but we’ll set up the Expert Bio field as True. Is the Expert Bio field null? Yes, there is no biography provided. As such, there’s no need to run this contact’s record information through Prompt Builder; therefore, we need a branch on its own to do its own thing.

Decision element for Short Post setup.

Set up the Short Post branch

We’re going to stick with the Short Post branch, as it’s made up of one simple element: an Action. Add an Action element, and then select Send Slack Message. This is going to post our expert’s information into our newly created “personnel-announcements” channel. The Set Connection Values for Slack section is pretty straightforward: We want to use Salesforce for Slack app; we want to post in my workspace, “Cloud Companion Advisors”; and we want to execute the post action as the Slack App. Under Set Slack Message Details, put the Slack Conversation ID (which is like a record ID in Salesforce to identify which channel we want to post to). You can find the ID in the Slack browser view in the same spot a record ID would be.

Send Slack Message Action element setup on Short Post.

I used a Text Template resource for our Slack Message, which we’ll name “shortSlackMessage”. The template is simple, but the format requires Plain Text when posting to Slack. Just like an email template, write out your text and put in your merge fields where you want to populate Salesforce data. Whenever you pick your merge fields from the “Insert a resource” box, always scroll down to the “Global Variable” section and click $Record. From there, you type in/search for the field you want to insert into your template. “$Record” means the triggering record, which is what we’re working on. For a short message, I simply wanted to communicate an expert’s credentials.

Text Template containing merge fields for Short Post.

That’s it for the short branch. When an Expert contact record is created, the flow will fire. It will identify that we have actions that need to take place. It will jump onto the scheduled path, after it realizes there’s nothing to do on the immediate path. It will review the contact record to see if it’s an Expert record type and decide whether or not the Expert Bio field is populated. If it’s not, we’re going to post a simple text with the expert’s name and credentials to the Slack channel that we created for personnel announcements. Boom. Done. Everyone knows we have an onboarded new hire.

Here’s an example of the Slack post.

Example of short Slack post with Text Template.

Onto the Full Post branch!

Set up the Full Post branch

Much like the Short Post branch, the Full Post branch starts with an Action. When you search Actions, you’re going to want to search the name of your activated prompt template (you won’t see it unless it’s activated).

Woah, hold up. Prompt template? When did we build that? Let’s back track a little. I’ll show you how to build a prompt so you can understand our ability to call on AI. And as we do so, we’ll discuss how we use AI in this scenario.

Using Prompt Builder

You can find Prompt Builder in Setup under Einstein > Einstein Generative AI > Prompt Builder. For this use case, we’re going to use the Field Generation prompt template type. This allows you to take all the information on an object and summarize it in a field on a Lightning record page. It’s different than Record Summary, because that template is used in conjunction with Copilot.

The Field Generation template will help us summarize our record information in conversational style, using human and natural language text. I named the prompt “Asst Generated Bio” and gave it a description. (Fun fact: That description becomes help text in your flow Action element so you know the purpose of the template.) Select your object (Contact), and then select which field you want to post the generated response. For this use case, we’re posting in the Assisted_Generated_Biography__c long text field.

New Prompt Template setup.

The Prompt Builder Workspace is where we set up our Field Generation template. There are three sections that make up Prompt Builder. The first section is at the top, containing areas (1) and (2). This is your creative space. The canvas (1) is where you can write your prompts. The Resource bar (2) is where you select the data you want to add to your template, using merge fields, Flow, Apex, etc.

The second section is at the bottom, containing areas (3), (4), and (5). This is where you can test your template. The Preview box (3) is where you insert a test record. The Resolution box (4) and Response box (5) work together to help guide you through your prompt template revisions. The Resolution displays how prompts and resources are resolved on the template, which is a fancy way of saying that’s where it’s inputting CRM field values within the template. The Response displays the AI-generated text using the information from the Resolution. Each time you revise your template and generate a new preview, these sections will update with a new prompt resolution and response.

On the right side of Prompt Builder is our third section, where Template Properties (6) live. This is where you control which model you use for your template. You can use a model provided by Salesforce or bring your own.

Prompt Builder template.

Sidebar: What makes a good prompt?

Let’s talk about the science behind writing a good prompt. Writing an effective prompt will directly impact the quality of your response. It’s a skill and, like any skill, it takes time to learn and grow it. There’s a symbiotic relationship of sorts between author and AI. As AI learns you, you learn AI. It’s a matter of testing, testing, and testing. You build your skill set by getting back what you don’t want and then sometimes landing on what you do want. So have patience—you’re benefitting from the experience.

Here are some basic tips for effective prompt writing.

  1. Be specific.
  2. Be concise.
  3. Avoid yes or no questions.
  4. Consider style and tone.

I’m a fan of the CTF Prompt Framework (Context, Task, Format).

  1. I assign a task: Go do something. In this case, we ask it to summarize our contact record.
  2. I give it context: Do it with the information provided in these merge fields.
  3. I assign a format: Give it back to me in a specific structure.

In this use case, I assign my task, “Make an exciting announcement about a new addition to the team”, which is a concise statement and provides a style and tone to my message.

Then, I go on to provide my context: “In the announcement include {!$Input:Contact.Name}, where they are from with {!$Input:Contact.location__c}, what kind of work they do with {!$Input:Contact.Role__c}, and that they are knowledgable with {!$Input:Contact.Clouds_Features__c}, in industries such as {!$Input:Contact.Industry_Experience__c}. List their certifications with {!$Input:Contact.Certifications__c}. Additionally, include a final line called ‘About {!$Input:Contact.Name}:’ and summarize {!$Input:Contact.E__c} into exactly two sentences citing years of experience and project experience.”

Finally, I assign format, which I learned heavily relies on your specificity. I say exactly how I want to start the announcement, “The following expert has been onboarded and is available for work”. (Note: When you want specific words or phrases, use quotations around them and Prompt Builder will plug it in.) I don’t want big, long paragraphs when we’re summarizing the bio, so I give specifics on how many sentences I want to see (exactly two) and I want to start the bio section with “About {!$Input:Contact.Name}:”. I also specify that I want to tag “This is AI generated content” at the end of the post.

Prompt for Assisted Generated Biography.

“This is AI generated content” is really important for our use case. Since AI came out, our vocabulary and phrases expanded to include words like large language model (LLM), grounding, and humans in the loop/humans out of the loop. Being that AI has been around for a bit, I’ve become familiar with the other two, but humans? AI needs humans and, in a way, it doesn’t. We need to prompt it, we need to push the button to generate it, but we don’t need to be part of its output.

As we grow our AI skill sets, we need to be conscious of our role in the final product that AI generates. In a flow like this, where we’re taking the response and posting it without review, we call that “Humans out of the loop.” We aren’t vetting its output, we aren’t cleaning it up, and we aren’t prompting it for more specifics. We’re simply generating it with the flow and sending it off. Kind of sounds scary when you say it that way. Our words carry weight. What AI communicates matters. That’s why it’s important, and even a best practice, to include a tag such as “This is AI generated content” in case AI misconstrues the message.

AI is advanced, but it’s not perfect. If our prompts aren’t specific enough or our data isn’t clean enough, it will spit out vague or inaccurate information. When using AI, we want to ensure that our data is complete, actionable, updated, and accurate. That’s why it’s so important to cover our tracks and signal that a human did not write nor review this message. However, in an instance where you’re not using AI in a flow like ours, and there’s an opportunity to review and further specify and refine its output, that’s what you call having a “Human in the loop.” In that case, you don’t need to tag anything because the message has been vetted and/or workshopped to be approved as accurate and true. Salesforce recommends you have that human in the loop when it comes to AI-generated information provided to your customers.

Back to our flow

We search and select the Prompt Builder template we created within the Action element. We tie it to our contact record so it knows what record’s field data to pull by specifying the RelatedEntity. We’re also going to take an empty text variable to capture the output. We’ll call it “promptBuilderOutput”. All the AI heavy lifting is really in building the template, not so much in the flow.

Action element Prompt Template Action.

Update Records element

The Prompt Builder response is sitting in our promptBuilderOutput variable. Now, we need to take that variable and update the Assisted Generated Bio text field with its response using an Update Records element.

Update Records element.

Send Slack Message Action

Last but not least, we post to Slack. The Send Slack Message Action is set up just the same as it was in the Short Post branch; the only difference is that we use the promptBuilderOutput variable as the Slack Message.

Send Slack Message Action element setup on Full Post.

This sends the Slack message with the bio posts. Boom. Done.

Everyone knows there’s a new expert ready for work and they have a little bit of background info on them. The folks that need to know more and get into the details can go to the contact record to review the entire biography. This Slack post gives a feel for the person that is coming on board. The neat thing is nobody had to spend time writing the post, and it doesn’t read the same way every time we have a new hire onboarded. That would be boring. This is an exciting time for the team and the individual! It should be addressed as such.

Slack post made using Prompt Builder.

Business results

Building this solution has helped our team work efficiently and effectively. We’re able to keep up with the fast-paced flow of work in a concise, organized manner—and in real time. By posting to a Slack channel, we broke down siloed communications and are communicating searchable information to all applicable team members. We take out the manpower behind such communications, by leveraging automation tools such as Flow and harnessing the power of AI to craft repetitive announcements into many unique Slack posts that elicit excitement.

Do try this at home

The heart of this flow is the AI. I recommend practicing your prompts and spending time building that skill set. If you don’t have the Einstein 1 Platform, you can still launch an Einstein 1 dev org through the Quick Start: Prompt Builder badge. You’ll have access to that org for 5 days.

AI is what everyone’s talking about, so keep your eyes and ears open to what Salesforce is publishing. Each article, podcast, and video has its own golden nuggets of advice. Trailhead is also great for flow building. Since the migration to Flow, a lot of time has been put into buffing up the flow badges on Trailhead. I’ve witnessed these badges evolve, and they’re bursting at the seams with more videos and detailed steps on how to execute a flow. If it’s been a while since reviewing them, there’s nothing wrong with going back to see what new information is in there!

Resources

Want to see more good stuff? Subscribe to our channel!

SUBSCRIBE TODAY
How I Solved It with Jennifer Lee and Dee Ervin

Search Unsearchable Field Data Types | How I Solved It

Welcome to another “How I Solved It.” In this series, we do a deep dive into a specific business problem and share how one Awesome Admin chose to solve it. Once you learn how they solved their specific problem, you’ll be inspired to try their solution yourself! Watch how Dee Ervin searched unsearchable field data […]

READ MORE
Increase productivity and create starter flows fast with Einstein for Flow

Increase Productivity by Creating Starter Flows Fast Using Einstein for Flow | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, learn how Eduardo Guzman enhanced productivity and […]

READ MORE