You need to sign in to do that
Don't have an account?
hugogmendes
LWC Output Field is not showing values for some lookup fields
Hello everyone!
I've created a lightning-record-view-form with several fields. Some of the fields are lookups and the lookup fields are for differents objects, including custom and standard objects. The issue is that some of lookups isn't showing any value, but other do show.
<lightning-record-view-form record-id={recordId} object-api-name="Suprimentos__c"> <div class="slds-form" role="list"> <div class="slds-section slds-is-open"> <h3 class="slds-section__title slds-theme_shade"> <span class="slds-truncate slds-p-horizontal_small" title="Detalhes do chamado"> Detalhes do chamado </span> </h3> <div aria-hidden="false" class="slds-section__content"> <div class="slds-form__row"> <template if:true={exibirPropChamado}> <div class="slds-form__item slds-size_1-of-2" role="listitem"> <lightning-output-field variant="label-stacked" field-name="Proprietario_do_chamado__c" id="Read_Proprietario_do_chamado__c"> </lightning-output-field> </div> </template> </div> <div class="slds-form__row"> <div class="slds-form__item slds-size_1-of-2" role="listitem"> <lightning-output-field field-name="Empresa__c" id="Read_Empresa__c" variant="label-stacked"> </lightning-output-field> </div> </div> </div> </div> </div> </lightning-record-view-form>
In my code above, both fields Proprietario_do_chamado__c (User) and Empresa__c (Account) are filled, but only Proprietario_do_chamado__c is showing the value.
I'm pretty sure that api field name is correct for Empresa__c.
Someone knows how to solve this?
All Answers
I checked it and I have all necessary permissions. Actually, in standard layout, the field Empresa__c is showing correctly.
Also, in lightning-record-edit-form the value is displayed. So, I believe that the problem is with lightning-record-view-form.
I'm not sure if it's a bug or I coded something wrong.
I realized that the field value is only displayed when the field is present in the page layout. I debug load event and found that, actually, the value is populated, but not its mask.
Output JSON:
It seems that aura component has the same problem Lookup fields which is not a part of page layout is not working as expected with lightning data services (https://success.salesforce.com/issues_view?id=a1p3A000001RWq7QAG)