0

I have a simple Lightning page opened from a quick action on Account. This action creates or updates let's say a custom order (let's call them MyOrder__c and MyOrderLine__c). MyOrderLine__c is in master-detail under MyOrder__c. MyOrder__c is in master-detail under Account.

I'm using the Salesforce standard mobile app : I open an account, go to the "Edit myorder" quick action which displays this Lightning page. I edit order lines (only updates, no inserts) on the current order. The app works fine in a web browser, also on mobile (iPhone and Androïd) when online.

I have set offline options on the Salesforce mobile app to sync Tasks, Accounts and Opps. As MyOrder__c is MD under Account, it does not show up on the Offline settings page in the mobile app.

Now the following scenario works correctly on Androïd, but has an unwanted behaviour on an iPhone :

  • my phone is online
  • I go to an account, and open the Lightning page from the quick action
  • I go offline (by switching to Airplane mode - same result when cutting off Wifi and cellular data roaming)
  • I then get a system alert in the app (toaster) saying I'm offline
  • I start editing data in the Lightning page
  • the app has an autosave feature : when autosaving, it detects that it is offline, and let's me carry on. So now, i have edited records locally, on the screen
  • I switch the phone back online (either with Airplane mode off, or y allowing cellular data roaming again) -

=> on Androïd, all goes well : I can carry on editing, or just save my previous edits

=> on iPhone, as soon as I switch back from System Preferences to the app, I get a refresh in the app (hexagonal blob) which refreshes back to the situation where I last saved before going offline. So all my edits made while I was offline are lost.

Of course, the Lightning page is doing standard save operations, no calls to Mobile SDK features such as soups etc.

What we have done to try to work around this :

  1. try to catch the "ack-online" system event (in case, for some reason, the refresh was triggered from within the app) => no success, we could not prevent the refresh
  2. try to launch a save operation immediately the moment we detect we are back online, hopefully before the "back-online" event refreshes the page => no success either

My questions are :

  1. does anyone understand what might going on, here ?
  2. can anyone explain why the behaviour on Android and iPhone are different ?
  3. has anyone got documentation on how system events (such as offline or ack-online) are handled on different platforms by the standard Salesforce mobile app container ?
  4. has anyone handled or worked around such a situation ?
  5. what is the correct read-save operation to use in Lightning to take advantage of the standard offline features of the Salesforce mobile app ? force:recordData might e an idea for MyOrder__c but how should we load MyOrderLines__c ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.