function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tasia Demuth 4Tasia Demuth 4 

Lightning component not working in mobile

Hi!! 

I have a lightning component that I am using in a flow to search for contacts. It works great on a desktop (see image below) but the search does not work in mobile. 

What am I missing? 

Any help would be greatly appreciated!
Tasia

User-added image

Here is my lightning component code:

Component
<aura:component implements="force:appHostable,lightning:availableForFlowScreens,flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="Contact" type="String" access="public" />
    <aura:attribute name="ContactLookup" type="String" access="public" />
    <aura:attribute name="ContactLookup__c" type="String" access="public" />
    <aura:attribute name="selectedRecordId" type="String" access="public" />
    
    <lightning:recordEditForm objectApiName="{!v.Contact}">
        <label class="ContactLookup">{!v.ContactLookup}</label>
        <lightning:inputField fieldName="{!v.ContactLookup__c}" onchange="{!c.handleOnChange}" />
    </lightning:recordEditForm>
</aura:component>    

Controller
({
    handleOnChange : function(component, event, helper) {
        component.set( "v.selectedRecordId", event.getParams( "fields" ).value );
    }
})

Style
.THIS label.slds-form-element__label {
    display: none;
}
.THIS .fieldLabel {
    font-size: .75rem;
}​​​​​​​

Design
<design:component>
    <design:attribute name="Contact" />
    <design:attribute name="ContactLookup" />
    <design:attribute name="ContactLookup__c" />
    <design:attribute name="selectedRecordId" />
</design:component>
 
Snehil_JaiswalSnehil_Jaiswal

Hi Tasia,

Issue is with lightning:inputField. lightining:inputField doesn't work in salesforce1 but force:inputField work. 

Here is the solution for this problem.

https://salesforce.stackexchange.com/questions/256059/lightninginputfield-lookup-mobile (https://salesforce.stackexchange.com/questions/256059/lightninginputfield-lookup-mobile" target="_blank)

Hope this will work.

If you have any problem do let me know. I will be happy to resolve that.

 

Thank You,

Snehil Jaiswal

Tasia Demuth 4Tasia Demuth 4
Thank you, Snehil. I am trying, but failing to figure it out. I cannot figure out how to get an Sobject into the force:Inputfield. My app is saying that there needs to be an Sobject. Any help would be greatly appreciated. Thanks, Tasia
Alain CabonAlain Cabon
Hi Tasia,

1) <force:inputField> is one of the most mysterious components of Lightning Aura.

Many people spent months in order to find the solution to the problem of the lookup fields with lightning components for desktop and mobile.

David Cheng (Salesforce MVP) tried the proposed solution above and failed for his own case ("I had high hopes but alas it doesn't work for me", May 31).

In your case, that could work but you will need to use the code of the controller moreover for the initialization of the field.

2) <force:inputField> is not the panacea unfortunately because it is extremely capricious
https://developer.salesforce.com/forums/?id=906F0000000D6RwIAK.
isalew (2016): I just finished a multi-month marathon with Salesforce R&D on the issue of <force:inputField> components not working. Here is the solution/workaround we achieved: http://salesforce.stackexchange.com/questions/119455/lightning-component-initialization-after-redirect/131610#131610  ... even the Salesforce R&D doesn't communicate clearly about this mysterious component and the documentation is almost empty (the minimal given sample is not a lookup):  https://developer.salesforce.com/docs/component-library/bundle/force:inputField/specification

3) Officially, the only standard lookup for Lightning is <lightning:inputField> but that doesn't work for the mobile app officially (many criticisms).

<lightning:inputField> Lookup: The lookup type is supported in Lightning Experience only. Mobile lookups are not supported. When used in the mobile app, the lookup type is rendered as an input text field.
https://developer.salesforce.com/docs/component-library/bundle/lightning:inputField/documentation

4) Critics - Marcus Torres and Greg Rewis are the experts of the Lex component at Salesforce.

Austin Lawler - 2 months ago
We have to have our community pages functional on mobile and this is a major blocker. 10k+ users primarily on ipads that we have no answer for.

Nic E. - 3 months ago
@[Marcus Torres] Any word when lookup fields will work on mobile?  For a mobile-first outlook, this is major missing functionality

https://success.salesforce.com/ideaView?id=08730000000Dom1AAC

5) My own solution is to use a French component that works for all ( Aura / LWC - desktop and mobile ) because that is a clear disaster of Salesforce for the mobile app (major missing functionality and major blocker) so we need to find a good workaround.
https://github.com/pozil/sfdc-ui-lookup

If the solution above works for you, that will be simpler than a new sfdc-ui-lookup but no one has communicated about <force:inputField> at Salesforce for months (years?).
Tasia Demuth 4Tasia Demuth 4
Thank you, Alain! You are always so helpful! I found this component on the app exchange that can be used in Flows. https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000ErH8PUAV This will serve my purposes for now, but I really appreciate you providing me such great feedback. I will keep your component in mind if I ever need a lookup that is not used in Flow. Thanks! Tasia
Alain CabonAlain Cabon
Hi Tasia,

Lightning Universal Lookup Component is great and easy to install (I tested it some months ago) but you don't have the source code and the licence could change in the future (not free anymore perhaps or even removed from Appexchange). 
That is why I prefer the French component maintained by an expert of Salesforce but the installation is more complicated.

The other well-known free loopup component is strikeLookup (Appiphony)http://www.lightningstrike.io/#!/strikeLookup
A bit more complicated to install and perhaps not perfect for the mobile app because Denise Crosby found a minor glitch on iPhone 6 in 2017.  https://developer.salesforce.com/forums/?id=9060G000000MUuNQAW

With strikeLookup, you have all the source code.

Alain