I have a simple Product2
details component.
Component
<aura:component implements="lightning:isUrlAddressable, flexipage:availableForAllPageTypes">
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<aura:attribute name="productId" type="String" />
<aura:if isTrue="{!not(empty(v.productId))}">
<lightning:recordViewForm recordId="{!v.productId }" objectApiName="Product2">
<lightning:outputField fieldName="Name" />
</lightning:recordViewForm>
</aura:if>
</aura:component>
JavaScript Controller
init: function (cmp, event, helper) {
let pageReference = cmp.get("v.pageReference");
let productId = pageReference.state.c__productId;
cmp.set("v.productId", productId);
}
It works when viewed via desktop, but does not load via mobile.
The <lightning:recordViewForm
component support mobile and I've tested using the Account
object and it worked:
<lightning:recordViewForm recordId="0010w000002HsJOAA0" objectApiName="Account">
<lightning:outputField fieldName="Name" />
</lightning:recordViewForm>
I also tried with a hardcoded Product2
Id and it didn't work on mobile, but did work when viewed on desktop.
<lightning:recordViewForm recordId="XXXXXXXXXXXXX" objectApiName="Product2">
<lightning:outputField fieldName="Name" />
</lightning:recordViewForm>
Why does it fail to work for Product2
on mobile?
Is it possible to get it to work, or should I just use a Apex Controller?
implements="lightning:isUrlAddressable