lightning-record-view-form : jayakrishnasfdc
by: jayakrishnasfdc
blow post content copied from Jayakrishna Ganjikunta
click here to view original post
Use the lightning-record-view-form component to create a form that displays Salesforce record data for specified fields associated with that record. The fields are rendered with their labels and current values as read-only.
You can customize the form layout or provide custom rendering of record data. If you don’t require customizations, use lightning-record-form instead.
To specify read-only fields, use lightning-output-field components inside lightning-record-view-form.
lightning-record-view-form requires a record ID to display the fields on the record. It doesn’t require additional Apex controllers or Lightning Data Service to display record data. This component also takes care of field-level security and sharing for you, so users see only the data they have access to.
recordViewForm.html
<template>
<lightning-card title="Account Details Record View Form">
<lightning-layout>
<lightning-layout-item>
<lightning-record-view-form
record-id="0017F000HGFH7ll2QAA"
object-api-name="Account">
<lightning-output-field field-name="Name"></lightning-output-field>
<lightning-output-field field-name="Type"></lightning-output-field>
<lightning-output-field field-name="OwnerId"></lightning-output-field>
<lightning-output-field field-name="LastModifiedById"></lightning-output-field>
</lightning-record-view-form>
</lightning-layout-item>
</lightning-layout>
</lightning-card>
</template>
recordViewForm.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="recordViewForm"> <apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Output:
December 08, 2020 at 02:55PM
Click here for more details...
=============================
The original post is available in Jayakrishna Ganjikunta by jayakrishnasfdc
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Post a Comment