Working with record data.

Record View Form & Record Edit Form Lightning Components

Salesforce Spring ’18 release keeps the excitement continued with many more base lightning components. Ligtning Record View Form and Record Edit Form makes it easy to work with salesforce records in a Lightning component. Quickly asssemble Detail & Edit form for any record without the need for additional Apex code and Lightning data services. The best part, FLS is automatically enfored, and the fields can be displayed in a consistent manner for all different field types.

 

Record View Form

Here is a quick sample to display Lead record data for Detail mode.

<lightning:recordViewForm recordId=”001XXXXXXXXXXXXXXX” objectApiName=”Lead”>

<lightning:outputField fieldName=”LastName” />
<lightning:outputField fieldName=”FirstName” />

</lightning:recordViewForm>

Read more about this component from here

Record Edit Form

Here is a quick sample to display Lead record data for Edit mode.

<lightning:recordEditForm recordId=”001XXXXXXXXXXXXXXX” objectApiName=”Lead”>

<lightning:inputField fieldName=”LastName” />
<lightning:inputField fieldName=”FirstName” />

</lightning:recordEditForm>

Read more about this component from here