Challenge Overview
Challenge Overview
The CMC Estimates app is an AngularJS app which uses Salesforce as it's datastore. Currently if a user saves an estimate and the connection to Salesforce is not active all the data is lost. A solution is needed to keep data locally if the connection to Salesforce is lost and re-sync back to Salesforce after the connection becomes active.
The primary goal of this challenge is to remove the current user experince of losing data if connection so Salesforce is not present when the save button is clicked.
Challenge Details
- Implement a local storage for the estimate object.
- The Estimates App must stay up to date with Salesforce if the connection is current.
- Use a last save wins conflict resolution strategy.
- Notify the user if the connection to Salesforce is not active when a save is attempted.
- A live sync is not required.
- The local data must be able to live between page refreshes.
Possible Solutions might be but are not limited to:
- Use IndexedDB with this AngularJS plugin https://github.com/webcss/angular-indexedDB then we write a sync adapater to Salesforce
- Create a PouchDB adapter for Salesforce and use https://github.com/wspringer/angular-pouchdb to integrate with Angular
Final Submission Guidelines
Solution must be written in angular.js and javascript.
Any external libraries not included require permission to use.
Setup
Download the .zip file with the code. Extract. launch on a local webserver. An install script called "install.sh" is available to automate the setup to run estimates locally. The script installs grunt-cli, runs npm install and creates a symbolic link from src to cmc. Once this is run you can run "grunt server" and navigate to http://localhost:8080/cmc/wm/estimates/index.html. Otherwise, run on any webserver.
Firebase Setup:
- Go to www.firebase.com and sign up if not already done. Create a firebase. Copy it's url.
- Import firebase_start.json (attached in forum) to your firebase for some starter data.
- Edit cmc/src/wm/estimates/index.html line 21 to go to your firebase url you copied in step 1 above.