relatedList
Retrieves data of Salesforce records sharing a common parent record and object type, and stores the results into the variable context as a Collection of Data item values.
A common companion of relatedList
is record, which offers another relatively simple data retrieval interface. If more complex or efficient data queries are needed, the query command offers the use of freely defined SOQL queries.
Attributes
var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Name of the variable that holds the Collection. |
type | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
The resolved value of this attribute should be the API name of the object type that the child records share. |
parentID | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
Defines the ID of the parent record. |
parentType | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
The resolved value of this attribute should be the API name of the parent record's object type. |
fields | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
Defines the fields whose values are retrieved. The resolved String should be a comma-separated list of the fields' API names, e.g. "Id, Name,Quantity".'' If the resolved set of fields contains names of fields that don't exist or otherwise cannot be retrieved, the command will still succeed but the Data items will not contain entries for the "invalid" fields. A warning listing the "invalid" fields is also produced. |
orderBy | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines fields by whose values the results are sorted. The resolved String should be a comma-separated list of child record field API names. |
where | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
This attribute can be used to define filtering conditions to limit the amount of results. The resolved String should specify one or more condition expressions in SOQL Condition Expression Syntax. |
Examples
Get an Opportunity record's OpportunityLineItems:
<relatedList var="lineItems" type="OpportunityLineItem" parentID="${oppID}" parentType="Opportunity" fields="Product2.Name, Quantity">
Use the orderBy
and where
attributes to sort and narrow the list of results:
<relatedList var="plentifulLineItems" type="OpportunityLineItem" parentID="${oppID}" parentType="Opportunity" fields="Product2.Name, Quantity" where="Quantity > 100" orderBy="Quantity">