relatedListRecord
Retrieves data of a child record of a specified parent record and stores the result into the variable context as a Data item.
Highly similar to relatedList, but only retrieves one child record.
Attributes
var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Name of the variable that holds the Data item. |
type | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
The resolved value of this attribute should be the API name ofthe child record's object type. |
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 ofthe 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 item will not contain entries for the "invalid" fields. A warning listing these "invalid" fields is also produced. |
where | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
This attribute defines the filtering conditions to limit the amount of results, preferably to a single record. The resolved String should specify one or more condition expressions in SOQL Condition Expression Syntax. |
Examples
The relatedListRecord
command can be used to retrieve a child record whose ID you don't know (as then you could just use record). The where
attribute should be set to a SOQL condition expression that limits the possible results to a single record, as otherwise it is uncertain which record the command retrieves. One common example is the retrieval of an Opportunity's primary contact:
<relatedListRecord var="PrimaryContactRole"fields="Contact.Name, Contact.Email"parentID="${opp.id}"parentType="Opportunity"type="OpportunityContactRole"where="IsPrimary = true" />
This works well as the "IsPrimary" field can only be "true" for one OpportunityContactRole record linked to a particular Opportunity.