Challenge Overview
This challenge is the second in a series where we will attempt to build the components for a Ionic iOS Mobile Sales App that uses Salesforce Backend. The premise of the of the App is for Corellian Engineering Corporation Salesperson to request sample equipment for their customers (Rebellion Space Pilots) while they are on planets that may not have wifi or any network connectivity. Based on the earlier challenges, we’ve built an app which does basic syncing operations up/ down for contacts, products and sample requests.
As part of this challenge, we want to achieve 3 key objectives
-
Fix certain bugs in the existing app
-
Add finger signature capability to this app & sync it upstream in Salesforce
-
Ability to sync signature offline to Salesforce ($500 Bonus)
The source code for existing application, demo org credentials are available here - https://github.com/kbowerma/kesselrun
-
Bug fixes
-
The app can only show up to 10 items in a list view. If I sync and there are more, only 10 are shown. If I try to swipe to paginate, no more are shown. This is a major problem for Sample Requests which will have more than 10 owned by the user or authorized to the user, especially since you order the requests by id ascending (vs. descending to at least get the newest ones at the top).
-
PIN code should be required to use the app when offline. From spec: "The app should be pin code protected when the device is offline". You only require the PIN code on app startup, whether online or offline, which is not correct.
-
Editing a sample request locally, then sync'ing doesn't work. The sample request isn't changed in Salesforce and locally the blue edit icon remains on the sample request in the list view forever (until reinstall app). This is a major issue since bidirectional sync is required for sample requests. If I then change the sample request on Salesforce and sync, the changes in Salesforce are not sync'ed to the local copy.
-
Also, when I create a sample request, I can select this product which is only local, and when I sync, the sample request created on Salesforce and locally do not have product set.
-
Similarly, when I create a sample request, I can select a contact which is only local, and when I sync, the sample request created on Salesforce and locally do not have contact set.
-
In edit sample request, I change the Delivery Date but after I Save, the date is shown as one day before what I selected in edit. Actually the converse of this issue is if the date in detail view is X, then when I open the edit page, the date is shown as X minus 1 day.
-
If a sample request is deleted on Salesforce, after I sync it still appears locally.
-
For sample request, please add a validation that quantity is mandatory. Currently, if we leave it blank and sync, it leads to a sync failed error
B) We want to add a capability to sign a sample request in a method similar to the one shown below.
The flow of this app is as follows
1. A sales peson creates a contact and creates a samplerequest which they select a product and a contact - done in earlier challenge
2. sampleRequest gets processed in salesforce - done in earlier challenge
3. Salesperson delivers the product to the customer (or wooki) and has them sign the ipad, then sampleRequest is mailed to them or attached in Salesforce. Create a PDF for the sample request along with the signature and attach it to the corresponding Sample Request record in Salesforce as an attachment (THIS CHALLENGE)
BONUS ($500 for the first submission that implements this)
Please note that a user should be able to sign a sample request multiple times so you should be able to store multiple signature images/ PDFs offline. The use case here is that a rep may sign thousands of offline requests while NOT having any Internet connectivity. Once, he has Internet, the app should detect the same and upload all signatures to Salesforce in a non-obtrusive manner. Currently, if the user goes offline while signing, the sample request is not signed but the signature is preserved and the user manually needs to press ‘Confirm’ to sync the data to Salesforce. This limitation must go away and the user should be able to sign a sample request in the same manner regardless of whether they’re offline or online. The current online flow for signing must work as is.
-
When Internet Connectivity is available, the app should automatically sync all unsynced signatures with Salesforce. Once syncing is complete, the app should then show a pop-up showing how many sample requests were sync’d up stream to Salesforce and if there were errors if any.
Suggested approach
-
While signing, check whether user is online or not
-
If online, current flow works as is
-
if offline, store the current signature with sample request id, user id and isSynced (set to false) in SmartStore
-
When user has Internet connectivity, check all requests in SmartStore which have isSynced set to false and sync these with Salesforce.
-
If a sample request signature is synced to Salesforce, set it’s isSynced flag to true so it’s not processed in the next offline run
One of the key objectives of this challenge is that the app app must demonstrate that it’s possible to send large number of signature data in an asynchronous and real time manner.
References
- There are multiple canvas/ JS based signature libraries. Here is one of them which is already integrated with Ionic - https://devdactic.com/signature-drawpad-ionic/
Resources on SmartStore/ Syncing
https://developer.salesforce.com/blogs/developer-relations/2012/11/using-smartstore-with-native-ios.html
https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/entity_framework_native_using.htm