RetrieveSalesforceObjects()

Returns a rowset with the selected information from Salesforce objects that match the criteria you specify.

To use this function, you must use Marketing Cloud Connect to integrate with Sales Cloud or Service Cloud.

This function returns data in a rowset. Use the Row() and Field() field functions to access individual fields. To prevent long-running functions from impacting email send performance, the resulting rowset is limited to 1,000 rows.

When you call this function, it issues a SOAP request to your Salesforce org. SOAP API requests aren’t subject to the API usage limits that apply to your org.

The RetrieveSalesforceObjects() function has five parameters:

  • objectName (string): Required. The API name of the Salesforce object to retrieve information from.
  • fieldsToRetrieve (string): Required. A comma-separated list of fields to retrieve information from.
  • queryFieldName (string): Required. The name of the field to filter on.
  • queryFieldOperator (string): Required. The operator to use for the filter.
  • queryFieldValue (string): Required. The value to filter on.

You can optionally include additional sets of query names, operators, and values by appending them to the list of parameters. The function uses AND logic to connect multiple query sets.

To call this function, pass it the name of the object to retrieve data from, and the fields that you want to retrieve. You must also pass at least one set of query parameters. A set of query parameters contains the name of the field to query, the operator to use, and the value to match. You can provide multiple sets of query parameters.

The example outputs a list of all leads in the "West" region that have and annual revenue value greater than 1,000,000.