VLOOKUP_ALL
Description
Queries the specified object and returns the designated fields (plus the record Id and lookup field) from all records that match one or more field-value pairs, with an optional additional filtering clause.
Syntax
VLOOKUP_ALL(target_object_name, return_field_names, ...[matching_field_name, matching_field_value], additional_clause_optional) -> List<Map<String, ANY>>
Parameters
| Parameter | Data Type | Required | Description |
|---|---|---|---|
| target_object_name | String | Yes | The API name of the object to query. |
| return_field_names | String | Yes | A comma-separated string of field API names to return from each matching record. |
| …matching_field_name | String | Yes | The name of the field used to match records. |
| …matching_field_value | Object | Yes | The field value used as matching criteria. |
| additional_clause_optional | String | No | Additional SOQL criteria for restricting or ordering the matching results. |
Example
VLOOKUP_ALL("Opportunity",
"Name, Amount",
"AccountId", Id)
-- Returns the Name and Amount from every Opportunity where AccountId matches the current record's Id.
-- Each record also includes Id and the lookup field (AccountId).Tips
SOQL queries have a governor limit of 50,000 rows per transaction. Because VLOOKUP_ALL returns every matching record, refine your matching criteria or
additional_clause_optionalto keep the result set within this limit.