0

I am trying to build a component (very first time) that shows the default lightning view (as if no override was ever used).The reason for this is because the classic version has custom code that is causing issues in Lightning. enter image description here

What I have so far:

<aura:component implements="lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="recordId" type="Id"/>
<aura:attribute name="record" type="Object" description="The record object to be displayed"/>
<aura:attribute name="simpleRecord" type="Object" description="A simplified view record object to be displayed"/>
<aura:attribute name="recordError" type="String" description="An error message bound to force:recordData"/>

<force:recordData aura:id="record"
                  layoutType="FULL"
                  recordId="{!v.recordId}"
                  targetError="{!v.recordError}"
                  targetRecord="{!v.record}"
                  targetFields ="{!v.simpleRecord}"
                  mode="VIEW"/>

<lightning:card iconName="standard:user" title="{! 'Broker for ' + v.simpleRecord.Name}">
    <div class="slds-p-left_large slds-p-right_medium">
        <lightning:recordForm aura:id="brokerForm"
                            recordId="{!v.simpleRecord.Broker__c}"
                            objectApiName="Broker__c"
                            fields="{!v.brokerFields}"
                            columns="2"
                            mode="View"/>
    </div>
</lightning:card>

Any help or information on this is greatly appreciated.

  • you want to display standard view of record through Lightning component? – sanket kumar Aug 25 '18 at 1:59
  • yes. just display the standard view. – MicroSumol Aug 25 '18 at 2:58
0

If you use Standard override for classic,you have two option.. either you keep the classic override in lightning or create lightning component and override it for Lightning separately.

But when you create Lightning component using Lightning data services, either you will Keep it in view mode or edit mode. So, What you can do is Create Your Lightning Component Using Force:recordForm and remove standard detail section and add your custom component. Force:recordForm show your form with inline edit capabilities. This is more preferred over doing manually using Force:recordEDItForm or Force:recordViewForm.

<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName,flexipage:availableForRecordHome,lightning:actionOverride">

<lightning:recordForm 
    recordId="0067F00000EWWjRQAX" 
    objectApiName="Opportunity"
    layoutType="Full" 
    mode="view" />

enter image description here

You not need to override the view button by following the above direction. Hope it helps you.

Reference:- https://developer.salesforce.com/docs/component-library/bundle/lightning:recordForm/documentation

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.