Agentforce Platform | Query Records
Finds and retrieves Salesforce records based on the user’s request and specific conditions, such as the values of fields.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions with Foundations, or Agentforce 1 or Einstein 1 Editions |
| User Permissions Needed | |
|---|---|
| See Common User Access for Standard Agent Actions. | |
Action Details
| API Name | QueryRecords |
| Reference Action Type | Standard Action |
| Does this action execute one or more prompt templates? | No |
Considerations
For overall considerations for Agentforce, see Agentforce Considerations
- This action supports only English language.
- This action works with any searchable and queryable standard objects supported by the User Interface API and any searchable custom objects. External objects are not supported.
- Queries with data from multiple objects aren’t supported. For example, a user can’t view their leads and opportunities with one request.
- This action can filter search results by querying up to one parent-to-child or child-to-parent relationship. For example, a user can ask: "What's the average amount of closed opportunities that have an account based in the United States?"
- Queries that retrieve data based on a lookup field, related list, or a picklist don’t always work.
- The maximum number of results displayed is 50, even if more than 50 matching results are found.
- Field normalization isn’t available, so retrieving records based on field values is format-dependent. For example, the user request “Get my contact with phone number 415-123-4567” returns results only if the phone number is entered in the exact same format.
- Queries with ambiguous filter or sort criteria are determined by the LLM. No specific business rules are used. For example, if a user requests their “top” opportunity, the LLM can interpret “top” to mean the opportunity with the highest amount or soonest close date. If you have questions about the criteria used to retrieve the search results, view the plan in Agentforce Builder.
- Synonyms are supported for common standard objects and fields. For example, if a user’s request includes the word “deal,” the action can determine that the user is referring to an opportunity. Customization of synonyms isn’t supported. Synonyms for custom objects or fields aren’t always interpreted accurately.
- A limited set of default standard fields for the Account, Contact, Case, Opportunity, and Lead objects are supported. Other fields are supported only if they're included in the queried object’s default searchable layout and the default record page layout. If the object has a large number of fields, the action can limit the number of fields included in the search.
- When results are returned, a maximum of 10 fields are dynamically chosen based on a combination of the search layout and query criteria. For example, if a user wants to see their opportunities sorted by rating and the Rating field isn’t part of the search layout, the action returns the Rating field along with nine fields from the search layout for a total of ten fields.
- Results are returned only when the full search criteria are met. Partial results aren’t supported. If a user requests information based on two fields but they only have access to one of those fields, the query returns an error instead of returning results based on just one of the fields.
- Implicit field lookups aren't fully supported. To retrieve records with a specific field match, mention the precise field and value in the query. For example, for more accurate results, a user can enter, “List my accounts that have an Industry of Technology” rather than "List my technology accounts."
Did this article solve your issue?
Let us know so we can improve!

