With the recent introduction of Agentforce, more and more use cases have been pouring in – clients are discovering innovative ways to use this new tool. However, the created agents have somewhat limited capabilities. Without undermining what we have, I feel as though Agentforce has a lot more to offer than Field Generation, Record Summary, and Knowledge answers.
This leads me to ask: what if I can help my new agent to actually generate some data and perform mass updates (compared to Field Generation where it proposes one value for one field)? In this article, I will show you how to perform a mass update by combining prompt templates, flows, and a bit of apex. The Agentforce use case I’m presenting is a real scenario where we use AI to match employees with tasks based on skills and propose the most compatible employee for each task. Let’s get to it!
Defining Our Data Model
Before we begin, we need to define our data model. Firstly, we have a list of employees, projects, and their respective tasks. Next, we put the skill setup in place – each task would have a list of required skills, and each employee will have a list of their own respective skills. Each skill has a name and a skill level.

Setting Up Flow and Prompt Builder
To properly use Agentforce for our use case, we need to define a Prompt Builder and the matching prompt flow. Let’s start with the flow.
- Create a prompt flow and define it to use automatic input variables. You might need to create the Prompt Template on the same object beforehand, but leave the prompt empty for now.
- Next, assign a new Variable to be equal to the “prompt template Input” variable. Ours is CurrentTask.
- Then we’re going to query the corresponding Employees on the project based on the CurrentTask and their respective skills.
- After fetching the Employee Skills, loop over the values and add an “add prompt instructions” block.

- In the Prompt instructions, add something that looks like the image below. This way, Agentforce understands that we’re checking the employee skills, and would better understand the skills/level of each.

- Now, do the same for the Task skills (query them, then loop, and add Prompt instructions with similar instructions).
- Finally, add final prompt instructions to tell the agent what to do with your data. For example:
- “You need to generate a score by matching between the names and the levels of each skill from the task:
{!Check_Task_Skills}
And then the names and the levels of each skill from the employee:{!CheckEmployeeSkills}
The matching score should be higher when the difference of skill levels is lower.”
Notice here we’re using the two previous prompts to provide the correct data and mapping. This will allow the agent to generate a matching score between each employee and the task at hand.
- “You need to generate a score by matching between the names and the levels of each skill from the task:
With the Flow well defined, let’s go back to the empty prompt we had created. We need to describe to the agent what its role is, what they should do, and what data to source from. Our ultimate goal is to do mass updates using the data the agent will provide. With this in mind, our prompt template instructions would look like this:

By defining the list format as a JSON List, I’m setting up the mass update directly. This is very easy to do in Apex since I can directly parse the agent response as a list of TaskAssigneeObject.
Screen Flow and Apex
- With our foundation in place, we still have two final steps. Create a screen flow to call the prompt template you created. This screen flow would be called from the action button on the Task page:

- Create an Apex Class to be invoked from the Flow – in this class we expect to get an input that’s a JSON List. This input should be parsed as a list of the TaskAssignee Object:

- By parsing this list, we can now query on the employees, tasks, and assignees in order to update the assignees’ score to this specific task.
- Lastly, add this method to the screen flow. You should get something like this:

Note: You need to get the response from the prompt template and set it in a variable. Then use this variable as input to the Apex action.
The final result should look something like this:

Building the Prompt Template
Whether you want to use the actual implementation or just a similar Agentforce use case, the critical part is the prompt template you’re going to build.
In our use case, we’re using a screen flow to call the prompt template, which generates the matching score based on the prompt flow data. Finally, the returned scoring is pushed to Apex to perform easy parsing and update.
However, we could have also configured the prompt to be called from an Agentforce action.
The action would be triggered by a conversation with the agent (you would need to configure the Topic and Action on the agent builder) and the output would be:
However, in this case, the agent would only be generating the data without updating the matching records – you would need to create another Flow and Action to do this.
Final Thoughts
The initial idea behind this functionality was to use Agentforce to match between a task and an employee based on skill matching, which was feasible on a singular Field Generation level.
By implementing a combination of Flows, Apex, and Prompt Templates we managed to innovate a bit more and use Agentforce to perform mass updates on records by generating its own answers and scoring.