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 Team Code Cortex built an asset management agent using Agentforce to provide their reps with quick access to critical real-time financial insights from Salesforce and external third-party sources via Data Cloud, enabling them to make informed decisions efficiently.
Key business problem
A fictional financial services company called Code Cortex Asset Management needed an asset management agent. Their reps required quick access to critical real-time financial insights from both Salesforce and external third-party sources. They also needed a way to ask for data from Salesforce, such as fund positions and sales figures, and integrate this information with information from sources like Morningstar and Bloomberg through Data Cloud for performance metrics and market events. This way, they could empower sales teams and managers to make informed decisions efficiently.
How I solved it
The Code Cortex team, made up of Benoy Jose, Mandy Wang, and myself, created an employee agent using Agentforce. Here’s how.
In Agent Builder, I created a new topic. The “General CRM + Asset Mgmt”topic has a classification description, scope, and at least one instruction.
I gave the prompt, “List all the firms with AUM greater than 100 million in the high yield fund.” The agent returns the firm name as 401K Consults with three other attributes from the Account object. The agent selected the General CRM + Asset Mgmttopic (with 15 instructions and 11 actions) and invoked the custom flow agent action called Get Accounts by Funds.
The Get Accounts By Fundflow is an autolaunched flow. I first use a (1) Get Records element called Get Portfolio by Fund, where we are getting the portfolio by fund from the Portfolio object in Salesforce. Based on what I found in the Get Records element, I’m going to then (2) assign the information to a variable called portfolioRecord using an Assignment element.
If I expand the Get Records element, I’m passing two input parameters. The first input parameter is AUM, which the agent passed to the flow as 100 million. The important thing to know about a flow agent action is that any data passed from the agent into our flow needs to be set as Available for input, since the data is coming from outside our flow.
Our second input parameter is fundName, that the agent passed as PGIM high yield fund. Since the information is being passed from outside our flow, the key here is to set the Availability Outside the Flow to Available for input.
Our last variable is called portfolioRecord, which I used in an Assignment element. I set the Availability Outside the Flow for this record variable to Available for output.
For my prompt “Give me the fund performance for the ticker for High Yield Fund”, the agent returns the 1 Year Performance, 3 Year Performance, and 5 Year performance for requested ticker. The agent selected the Retrieve Fund Performance from Data Cloud topic (with six instructions and one action) and invoked the custom flow action calledFund Performance.
Let’s review the autolaunched flow called Fund performance, where the agent passed the ticker into the flow and the flow returned the Morningstar fund performance information from the Fund Performanceobject in Data Cloud.
Here, I use a Get Recordselement using the ticker as input. We know there is only one record with the ticker, so we stop at the first record found. We store output in separate variables for 1 Year Performance, 3 Year Performance, 5 Year Performance, and corresponding Morningstar rating.
If you look at the variable declaration in the flow, I have set Ticker (Ticker) as input variable and 1 Year Performance (Yr1Performance), 1 Year Performance (Yr1Performance), 1 Year Performance (Yr1Performance), and Morningstar rating (MorningstarRating) as output variables.
Now, for my prompt, “Get my account holding funds with Morningstar ratings less than 3 stars”, the agent selects the General CRM + Asset Mgmttopic and invokes the custom flow action “Get accounts from funds lower than the specified rating”. The agent passes the low rating of 3 into the flow and it retrieves the collection of accounts; for example, Wells Fargo advisors and 401K Consults.
Let’s review the “Get Account with funds lower than the specified rating”autolaunched flow invoked by the agent.
We start with the Get Records element on the Fund Performance object, which is in Data Cloud. We’re looking for all records with a Morningstar rating that's less than the LowRating variable, which, in our case, is three. For each record found, we store the Morningstar Rating and the Product ID.
Then, we loop through all the records found in the Get Records element.
For each item in the loop, we assign the productID to a collection called ProductIDs.
From there, we perform another Get Records element, but this time, on a Salesforce object called Portfolio. We’re looking for a FundId that’s in the collection ProductIDs, from my previous step.
Next, we loop through all the records found in previous Get Records.
For each record in the loop, we take the AccountId and add it to a CollectionOfAccountIDs collection variable.
Lastly, we do a final Get Records on the Account object in Salesforce, where we’re looking for all accounts where the ID is in the CollectionOfAccountIDs. We store the records found in a new variable called CollectionofAccounts, storing specifically the ID and Account Name.
For the CollectionofAccountsvariable, I set the Availability Outside the Flow to Available for output, which means Flow will make the data available to the agent. Back to Agent Builder, my next prompt is to create opportunities with the information where the name is Hackathon 24, stage is ‘Qualification,’ and close date is 15 days from now.
In response, the agent selected the General CRM + Asset Mgmttopicand invoked the custom flow action Create Multiple Opportunities,sending the AccountIDs for Wells Fargo advisors and 401K Consults into the flow.
Now, let’s review the Create Multiple Opportunities autolaunched flow.
We use a Decision element to check whether our account list has accounts or not.
Then, we loop through each account found.
For each record in the loop, we assign opportunity values with the name of Hackathon 24, the stage as Qualification, and the CloseDate formula, which sets it to 15 days from today's date, and AccountId from the AccountIdList collection variable from the previous step.
Finally, we will create an Opportunity record using the Opportunity record assignment from the previous step.
Business results
We utilized prompt engineering and flows to efficiently retrieve less commonly used data with minimal effort for users. By hosting external industry data in Data Cloud, we helped users seamlessly combine it with Salesforce data. Additionally, we developed a simple interface that allows users to have natural conversations with the agent and quickly obtain answers.
Do try this at home
To get started, hit the trail and navigate to Get Ready for Agentforce on Trailhead to learn how Agentforce fits into your business goals, launch your first agent, and build a plan for artificial intelligence (AI) success. Create a playground—start building and configuring Agentforce with topics, custom actions, and instructions. Try searching for data in a Salesforce objects and get results. Fine-tune your prompts with multiple instructions that can handle the different types of questions users could ask. Here are a few use cases to try.
Find all contacts that have a specific attribute like ‘region’, ‘support tier’, ‘sales numbers’, etc.
Show contacts that match multiple attributes at the same time.
Use flows to combine multiple data points and use them as part of the prompt.
What is Data Cloud Governance? As a Salesforce Admin, you’re the backbone of your organization’s data management. You make sure everyone has the right data at the right time to do their jobs efficiently, while keeping everything secure, compliant, and running smoothly. But as we move into an agent-driven future, the workplace is evolving. Employees […]
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 Mike Reynolds set up permissions to […]
In today’s digital landscape, ensuring the security of customer data is one of the top priorities for Salesforce Admins. With the increasing frequency of security breaches, the need for robust protection of sensitive information is more critical than ever. Exposing services to the public internet inherently opens up vulnerabilities that can lead to unauthorized access, […]