I have a simple Product2 details 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" />


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" />

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" />

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?

  • Do you have the right FLS on the required field? – Jayant Das Jan 17 '19 at 22:41
  • @JayantDas I assume so, because it works when viewed using a desktop browser. Or am I miss understanding something? – Robs Jan 17 '19 at 22:58
  • Oh yes, missed that part. – Jayant Das Jan 17 '19 at 23:00
  • I cannot see v.pageReference attribute on component markup. From where you are getting it? – sanket kumar Jan 18 '19 at 3:36
  • @sanketkumar it comes from implements="lightning:isUrlAddressable – Robs Jan 18 '19 at 9:55

The problem is not with lightning component, it's with Salesforce 1 mobile App.

As I can see from these 2 Ideas, Product Object is not available in Salesforce 1 Mobile App, so your lightning:recordViewForm would respect that and won't load it on mobile.

Please upvote these 2 ideas for support



On digging deeper, it seems like the object who support quick action can only be supported on Mobile App


Workaround: Don't use Lightning Data services and use old lightning:input to show your data from product doing SOQL query in Apex.

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.