Retrieves values of specified fields of a single Salesforce record and stores the data into the variable context as a Data item.

A common companion of record is relatedList, 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 Data item.
type

Required
Value type
EL-evaluated
Yes
String Yes
The resolved value of this attribute should be the API name of the target record's object type. 
recordID

Required
Value type
EL-evaluated
Yes
String Yes
Defines the ID of the record whose data is to be retrieved.
fields

Required
Value type
EL-evaluated
Yes
String No
Defines the fields whose values are retrieved. The resolved String should be a comma-separated list of the fields' API names, eg. "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. 
mainRecord

Required
Value type
EL-evaluated
No Boolean No
If the value of this attribute is true, the object named in the type attribute is set as the main object of the template. If the document's logic, such as queries, require a record of a particular object type to be externally specified, that object type should be the main object.

If more than one record command has this attribute set as true, the command that is evaluated last sets the main object.

The default value of this attribute is false.

Examples

Use the record command when you need to get data of a single record whose Id is known.

<record var="mainOpp" type="Opportunity" recordID="${id}" fields="Name, CloseDate, Amount, Description">