Contact Us

May 22, 2024

May 13, 2026 3:58 pm

Optimizing Customer Transaction Queries in Agentforce

Share with

Understanding the Current Approach

A community member asked about optimizing their current approach, which involves using EmployeeAgent to identify the type of question being asked and then invoking one of two topic actions to retrieve data from Data 360.

These actions call a flow that uses Apex-defined actions to get insights from Data 360, either by aggregating and summarizing the data or by retrieving a data table or matrix of data points.

Limitations of the Current Approach

While this approach works for a specific set of questions, it doesn’t seem scalable due to the large number of rows in the dataset, making it impractical to pass the entire JSON or data table to the prompt template.

The root cause of this issue is the inability to efficiently handle large datasets in Data 360, leading to performance issues and token utilization concerns.

Alternative Approaches

Teams can consider using Tableau Next or calculated insights as alternative approaches to optimize their query process.

Tableau Next can provide a more optimized approach by allowing for more efficient data visualization and analysis, while calculated insights can help reduce the amount of data being retrieved and processed.

Optimizing the Query Process

To optimize the query process, teams can use Apex to define custom actions that retrieve only the necessary data from Data 360, reducing the amount of data being processed and improving performance.

ApexExample.cls

public class ApexExample {
public static List<Data360Object> retrieveData(String accountId) {
// Retrieve only the necessary data from Data 360
List<Data360Object> data = [SELECT Id, Name, Amount FROM Data360Object WHERE AccountId = :accountId];
return data;
}
}

Heads up: When using Apex, make sure to follow best practices for data retrieval and processing to avoid performance issues.

Best Practices

Checklist for Optimizing Customer Transaction Queries

  • Use Apex to define custom actions that retrieve only the necessary data from Data 360
  • Utilize calculated insights to reduce the amount of data being retrieved and processed
  • Consider using Tableau Next for more efficient data visualization and analysis
  • Optimize data retrieval and processing to improve performance
  • Follow best practices for token utilization to avoid performance issues

What is the recommended approach for handling large datasets in Data 360?

The recommended approach is to use a combination of Apex, calculated insights, and efficient data retrieval techniques to optimize the query process.

Can Tableau Next be used to optimize the query process?

Yes, Tableau Next can be used to provide a more optimized approach by allowing for more efficient data visualization and analysis.

What are the benefits of using calculated insights?

Calculated insights can help reduce the amount of data being retrieved and processed, improving performance and reducing token utilization concerns.

How can Apex be used to optimize the query process?

Apex can be used to define custom actions that retrieve only the necessary data from Data 360, reducing the amount of data being processed and improving performance.

Genetrix Technology · Salesforce Marketing Cloud Partner

Need help shipping this in production?

Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.

Get in Touch with Genetrix →

Blogs for the

Business-Savvy!​

Let’s Connect

A 30 min no cost strategy session
with cloud support expert

Let’s Connect

A 30 min no cost strategy session
with cloud support expert