Using CodeFlow or Platform Emulator as Community or Standard User

Overview

When using either the Platform Emulator or the CodeFlow Emulator for testing, if you are using your own Salesforce login credentials it is highly likely you will have greater permissions and/or different data visibility to the actual roles/profiles of the users that will be working with the application.

It is possible with a small amount setup to enable your test users (either ‘real’ users or users you have created for testing purposes) to be able to use the Platform Emulator and/or be their credentials be used to login to the CodeFlow Emulator to simulate as closely as possible not just the app behaviour but the app behaviour with the profile/role/data of an eventual production user.

Create Permission Set

Create and assign a permission set as follows

  1. Label = MobileCaddy Emulator Users
  2. API Name = MobileCaddy_Emulator_Users
  3. Description = This Permission Set should be applied to standard or community users who are being used for testing MobileCaddy applications with the Platform or CodeFlow Emulators
  4. Session Acitvation = Not Checked
  5. Licence = You must leave this as –None– (this is so you can apply and use across all Salesforce Licence Types)
  6. Next add the following to this Permission Set
  7. VisualForce Pages
    1. mobilecaddy1.DataPopulationMobileApp
    2. mobilecaddy1.AppViewer001_mc
  8. Apex Class Access
    1. Add a Classes with the prefix “mobilecaddy1”

Assign relevant Permission Sets

Locate the User or Community User you are going to test with, and then add/confirm the following Permission Sets;

  1. “MobileCaddy Emulator Users” (created in the previous steps)
  2. “MobileCaddy User (Generic)” (this comes with the MobileCaddy package)
  3. The Permission Set created from the DV (Dynamic Version) you are going to run against. (you can create this from the Dynamic Version record with the button ‘Create/Update Permission Set).
    This is to give access to the objects and fields that your user needs that you have Mobilised.

If you are using a Community User ensure that the profile has API access.

Prepare Community User and run the Platform Emulator

  1. Whilst logged into the platform as a System Administrator navigate to your Mobile Application record, and copy the Salesforce record ID (this is the last 15 characters at the end of the URL)
  2. Login to the Community as the Community User.
    Note – Ensure this is the community that you created for Mobile Application authentication (this should be a VisualForce community)
  3. Paste record ID on to the end of the Community Url (in place of IDXXXXXX) to navigate to the Mobile Application record as copied in the earlier step into a browser.
    Ie https://abc-abccommunity.csxx.force.com/IDXXXXXXX
  4. Press the button ‘Create Provisioning Record’
  5. Press Confirm
    This will navigate you to a VF page where you will be able to run the Platform Emulator (this is the ‘Provisioning Record’ for this Community User – this can be found later by a System Admin but it would be good to bookmark this page for ease when needing/using later).Press the button “Emulator (Debug)” to run up the Platform Emulator. Note you can use the browser developer console to inspect your application.(Note you will not be able to use the Platform Emulator unless your community is setup as VisualForce. Please contact MobileCaddy support for advice on how to proceed).

Prepare Std User and run the Platform Emulator

  1. Whilst logged into the platform as a System Administrator, navigate to your Mobile Application record, and copy the Salesforce record ID (this is the last 15 characters at the end of the URL)
  2. Login to Salesforce on the browser as the Std User (or the profile/user you wish to test against)
  3. Paste in the URL to the browser of the Mobile Application as above
  4. Press the button ‘Create Provisioning Record’
  5. Press Confirm
    This will navigate you to a VF page where you will be able to run the Platform Emulator (this is the ‘Provisioning Record’ for this Community User – this can be found later by a System Admin but it would be good to bookmark this page for ease when needing/using later)
  6. Press the button “Emulator (Debug)” to run up the Platform Emulator. Note you can use the browser developer console to inspect your application.

Prepare and run CodeFlow (Std or Community User)

  1. For Community Users only – Locate the index.tpl.html file in your project and update the window.SF_login_URL to point to the community URL endpoint.
  2. Ensure your mobileCaddy.buildName (in the index.tpl.html) aligns with your Mobile Application Key (which is called “Device App Name” on the MobileCaddy Application record e.g. BIZ001)
  3. Run the following from in the command terminal, in the root of your project structure. This will regenerate your apps index.html file, with the updated values
  4. Run the following from in the command terminal to start your application in your default browser, to clear the oauth session 9OR use another browser).
    This should prompt for oauth login information, login with you community or standard user’s credentials.

    NOTE this is only for running the CodeFlow Emulator – do not attempt to DEPLOY to the platform using these credentials.