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:
Output:

Lightning Record Form Edit

 

View mode:
Output:

Lightning Record Form 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:
Output:

Lightning Record Form ReadOnly

Try demo:

 

 

For more details refers to :  lightning:recordForm

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

Write a Response

Your email address will not be published.


2 comments on “Working and usage of lightning:recordForm”

  • 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
    ———————

    • 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?

      Thanks

Find Out How We Can Help

If you're ready to find out more about how SimplusLabs can help energize your workers, your customers, and your business with a different experience, let's talk.