+ Start a Discussion

Display a Formula field in a Lightning Component that is hidden in the Page Layout

Hi there,

I built a simple Lightning Component that display field of a record. The fields that I want to display in the component are all Formula fields, and I want to hide them in the Page Layout. When I hide them, the fields show as blank in the Lightning Component!! The only way to oversome this is to show the fields in the Page Layout.

Is there a way to show these fields in the Lightning Component and NOT in the Page Layout? 

Note that I am using the below to display the field in the component:
<div class="slds-col">
   <span>Deficiency<ui:outputRichText value="{!v.ConstRecord.Deficiency_Status__c}" /></span>

Is the field-level security of the field still read only to your profiles?
Hi krisstannum1.

These are all Formula fields, so they are all Read Only fields. If I remove them from the Layout, they won't show on the Lightning Component. But my problem is that I don't want them to be on the Component AS WELL AS on the page layout.

Any advice?

Matthew Wolfe 13Matthew Wolfe 13
If you use the <force:recordData/>, you can pull in specific fields rather than the fields available on the layout. 

<aura:component implements="force:hasRecordId,flexipage:availableForRecordHome">
    <aura:attribute name="accountRecord" type="Object"/>
    <aura:attribute name="recordLoadError" type="String"/>
    <force:recordData aura:id="recordLoader"
        <lightning:card iconName="standard:account" title="{!v.accountRecord.Name}" >
            <div class="slds-p-horizontal--small">
                <p class="slds-text-heading--medium"><lightning:formattedPhone title="Phone" value="{!v.accountRecord.Phone}" /></p>
                <p class="slds-truncate"><lightning:formattedText title="Description" value="{!v.accountRecord.Description}" /></p>
                <p class="slds-truncate"> <lightning:formattedText title="Industry" value="{!v.accountRecord.Industry}" /></p>