Working and usage of lightning:recordForm

Working and usage of lightning recordForm

A lightning:recordForm component enables you to quickly create forms to add, view, or update a record. Using this component to create record forms is easier than building forms manually with lightning:recordEditForm and lightning:recordViewForm.

The objectApiName attribute is always required, and the recordId is required unless you’re creating a record.This component doesn’t support all Salesforce standard objects. For example, the Event and Task objects are not supported.

The component accepts a mode value that determines the user interaction allowed for the form. The value for mode can be one of the following:

Edit:- Creates an editable form to add a record or update an existing one. When updating an existing record, specify the recordId.

View:- Creates a form to display a record that the user can also edit. The record fields each have an edit button. View mode is the default, and as such, can be omitted.

Readonly:- Creates a form to display a record without enabling edits. The form doesn’t display any buttons.

Edit mode:
View mode:

Notice that you can still edit the record from the view mode by clicking the edit button at the end of the field.

Readonly mode:

For more details refers to :  lightning:recordForm

Refer to link to know more about Difference b/w lightning:recordEditform, force:recordData and lightning:recordForm.

Back to list

Related Posts

3 thoughts on “Working and usage of lightning:recordForm

  1. Dimi says:

    Hello Nigam , and congratulation for your articles.

    take the opportunity of reading this article I would like to ask you If we can display information from a record what is linked with a lookup.

    for example , i have the object ‘”Product_Development__c”‘ with lookup field to Account.
    Can I display data from the account record which is a lookup with”Product_Development__c”
    how can I display the Account Name for example within the lightning:recordForm?

    Thanks in advance

    1. Nigam says:

      Hi Dimi,

      Thanks for reading our blog. We are happy to help you. We updated the above example(Try demo section). Where we are presenting Account lookup field on the contact. Please do let us know If you have any question?


  2. dimi says:

    Hello again,

    where exactly in the component file the Account lookup field on the contact is defined?

    thanks again

Leave a Reply

Your email address will not be published. Required fields are marked *