Scripting - Querying Salesforce Records
Salesforce records and fields can be queried from script plugins.
The example below queries Opportunity Products and displays the query results in a textarea.
Query Request
The Query API endpoint expects a queryRequest object in the POST body.
Query Limitations
The following limitations and restrictions apply to script queries:
- Queries must begin with
SELECT
. For insert and update actions, see Script Records. - Queries must end with
LIMIT N
where N is an integer between 1 and 200. This is a security and performance precaution to ensure the CX is optimally focused on small, focused data sets. - Queries may be dynamically generated in Javacript. But Apex variable convention is not supported, such as passing
WHERE Field = :variable
; - Queries may include relationship fields up to one level. Example
SELECT Product2.Name FROM...