Setup your dev env. and run in the CodeFlow Emulator
Get the tools
To get started you will need to have a few tools on your machine;
Details of how to install these can be found in our guide to setting up local development environments.
Install the MobileCaddy CLI
If you haven’t got it installed already then install the MobileCaddy CLI tool.
npm install -g mobilecaddy
Create the new application
NOTE: you may need to use the —sudo flag if running on some Mac and Linux environments.
mobilecaddy new ionic-seed-expenses myExpApp
Provisioning Record on Salesforce?
N.B. In order for your local app to successfully connect to Salesforce, you need to have created a MobileCaddy ‘User/Device Provisioning’ record in Salesforce. This record tells your local app which mobilised tables to use when connecting to Salesforce.
If you’ve installed and activated the MobileCaddy package yourself, then a provisioning record would have been automatically created.
If the MobileCaddy package was installed in the Salesforce org by another user then you need to follow these instructions in order to create a provisioning record:
- Log into Salesforce
- click on the Mobile Applications tab (you’ll need to have the MobileCaddy app selected in the dropdown on the right)
- select All in the list view dropdown and click Go
- select the record that has a Build Package Name of BIZ001
- in the Mobile Application record, click on the Create Provisioning Record button
- click Confirm
- you should see 2 new provisioning records in the ‘User/Device Provisioning’ related list for the Mobile Application record – with your name in the ‘App User SF Name’ field
Start up your application
With the application created and it’s dependencies installed we can start our app up in a local web server with the following command.
This command should open a new browser tab with out application running in it. NOTE: this may initially cause a new browser pop-up to appear for the authentication against the Salesforce platform, so beware if you have an adblock or pop-up blocker enabled.
Accessing this page should start building the application (in a similar way to how the app is built on a device). You can check progress using the Resources and Console tabs in your browsers Developer Tools. The application data persists in HTML5 Local Storage and so it can remain in place between sessions. If you want to clear the data you can achieve this by adding the following query parameters onto the end of the URLs.
- scrub=full – This will remove all local storage tables, including those relating to oAuth.
- scrub=true – This will remove all local storage tables, except those relating to oAuth.
Our next tutorial, Enhancing the Time & Expense App will take you through making some modifications to our new app. Onwards and upwards!