How Named Query API Simplifies Data Access for Agents and Apps
Named Query API streamlines data access in Salesforce by allowing admins and developers to define reusable SOQL queries that can be used in both Agentforce actions and REST APIs. This eliminates the need to update multiple places when a query or field changes, reducing complexity and improving maintainability. Teams can quickly create reusable queries for records like Cases, expose them via REST endpoints, and integrate seamlessly with custom agent actions. This approach simplifies external integrations and declarative agent interactions with Salesforce data.
- Define reusable SOQL queries once using the Named Query API in Salesforce Setup.
- Use Named Query API endpoints to simplify external REST API data access.
- Activate Named Query APIs in the API Catalog before using in Agentforce actions.
- Update queries centrally without changing flows, Apex, or integrations.
- Enable the feature in Setup under User Interface for Agent action usage.
Salesforce Named Query API is a new capability that helps admins and developers simplify how agents and external applications access data in Salesforce. By defining reusable SOQL queries, you can create custom agent actions and expose data through REST APIs in a cleaner, more consistent way. Existing Approaches to Data Access in Salesforce Today, external applications can access Salesforce data by sending a GET request to the REST API /query endpoint and including a SOQL query directly in the request. While this approach is flexible, it requires knowledge of SOQL. For Agentforce agents, data access is typically handled through tools such as autolaunched flows or Apex classes. With an autolaunched flow, you can use a Get Records element to retrieve data and return it as flow output. With Apex, you can expose an invocable method and then use it to create a custom agent action.