6

There seems to be an issue with lightning-record-form in Summer'19. According to documentation it's supposed to take care of field-level security and it used to (not showing a field to which User doesn't have access). Now if a certain profile has no READ access to a field included in fields attribute the component keeps showing spinner.

Is it a bug or am I doing something wrong?

That has probably nothing to do with my component but I will upload my code:

HTML

<template>

    <lightning-record-form object-api-name={objectApiName}
                           record-id={recordId}
                           columns={columns}
                           mode={mode}
                           onsuccess={handleSuccess}
                           fields={fieldsList}>
    </lightning-record-form>

</template>

JavaScript:

import { LightningElement, api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';

export default class DBORecordForm extends LightningElement {

    @api recordId;
    @api objectApiName;
    @api columns;
    @api mode = 'view';
    @api successMessage;
    @api fields;

    get fieldsList() {
        return this.fields ? this.fields.replace(/\s/g, '').split(',') : [];
    }

    handleSuccess() {
        if (this.successMessage) {
            const showToastEvt = new ShowToastEvent({
                title : this.successMessage,
                variant : 'success'
            });
            this.dispatchEvent(showToastEvt);
        }
    }

}

XML:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>45.0</apiVersion>
    <description>Record Form</description>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <property name="fields" type="String" label="Fields to display" required="true"
                description="List of fields separated by commas ( FirstName,LastName )"/>
            <property name="columns" type="Integer" default="2" label="Number of columns" min="1"/>
            <property name="mode" type="String" label="Form mode" datasource="view,edit,readonly" default="view" required="true"
                description="view/edit - can be switched between with edit/cancel/save. readonly - cannot change mode to edit"/>
            <property name="successMessage" type="String" label="Success message" description="If specified shows toast message."/>
        </targetConfig>
    </targetConfigs>
    <masterLabel>Record Form</masterLabel>
</LightningComponentBundle>

I am having the same issue when testing in Aura component (lightning:recordForm)

1

It was Salesforce bug. Issue should be resolved now. If you are still encountering similar problems contact Salesforce support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.