Discovery and Synchronization is the process of identifying what the backend is capable of and the data(s) structure/shapes. Once discovered, the process of downloading data such as all products and appointments within data range starts.
Discovery
The first time a user signs into the app, the backend is queried to get the following settings. This process can manually be triggered again by going to Settings > User Preferences > Reload Company Settings
- Figure out what connector (MarketSharp, Salesforce) and adapter (i360 Classic) to use
- Get version of API
- Get Current User
- Get schema, shape of the data, permissions
- Appointments
- Attachments
- Documents
- Events
- Marketing Opportunities
- Notes
- Products
- Projects
- Project Activities
- Prospects (Contacts)
- Quotes
- Quote Items
- Quote Templates
- Receipts and Adjustments
- Sales
- Sale Items
- Staff
- Tasks
- Get API limits, other information about the API being consumed (requests used today/total requests allowed)
- Get Custom Settings applied to current user
Once the discovery is complete, the synchronization process begins
Synchronization
For offline mode support, data needs to downloaded (all fields for entity and sub queries) during full data sync and ad hoc entity refreshes.
- When the app has been in the background for 240 minutes (4 hours) or longer, next time the user goes to the Home Screen, the synchronization process will run to refresh the users information.
- The app does not refresh after a time period when the app has been in the background so on next open, it doesn't interfere with what they may be currently working on.
- i360 Custom Objects are queried based on the Staff Record lookup. Salesforce native/standard objects are queried by the User field.
- All date ranges are days in the past and future. Thus if range is 90, it gets 90 days in the past and 90 days in the future.
- The following are lazy loaded to help improve performance as not all users use Quoting to only load Products and Quote Templates if and when they are needed. Loaded if there is at least 1 Quote already or if there are 0 Products loaded.
- Download all Products that are
Active - Download all Quote Templates and Quote Template Items
- Download all Products that are
MarketSharp
Discovery
- Get company information (timezone and company tax rate)
- Get current user (display name, username, and profile picture)
- Get drop down options
- Get schema, shape of the data
- Appointments
- Attachments
- Company
- Contacts
- Employee
- Jobs
- Payments (Job Financials)
- Quotes
- Quote Items
Synchronization
- Get appointments by date range (defaults to 8 days)
- Get activities by due date range (defaults to 8 days)
- Get Contacts related to the appointments retrieved
- Get Calendar Events by date range (defaults to 8 days)
- Geocodes inquiry addresses that do not have a lat/long
- Get all Proposals
- Get all employees
For offline mode support, data needs to downloaded (all fields for entity and sub queries) during full data sync and ad hoc entity refreshes.
- Current user profile picture is pulled in upon login.
- If the user switches profile picture, the user will need to log out and log back in in order to see the new uploaded profile picture.
- All date ranges are days in the past and future. Thus if range is 90, it gets all appointments 90 days in the past and 90 days in the future.
- Download all appointments in date range assigned to the Sales Rep
- Appointments do not have an end date/time. Only a start date/time.
- Displays current user appointments for today
- The contacts with appointments in the date range days are downloaded
- Company timezone and company tax rate is set in General Setup in admin
- Appointment dates/times do not shift if the user is in a different timezone than the company set.
Salesforce Classic
- Get current Salesforce API version (current version minus 1). i.e. If users for is currently on version 50, use version 49. This is so the user is using an up to date version but not cutting edge.
- Determine if user has i360 Salesforce Classic in the organization by seeing what objects are available
- Get the current signed in user profile information
- Get the Organizations API Limits
- Get the user Page Layouts for all required objects and any necessary Custom Settings.
- Completes the data sync base on what type of user is signed into. See sections below for more details
- Cleans up any old data (i.e. Appointments no longer assigned to the sales rep)
Salesforce Classic
- Download all appointments in date range assigned to the Sales Rep
- Date range based on:
i360__Public_System_Settings__c.i360__Mobile_Appointments_Days_Back__cor defaults to43days - Appointments must have a Start Time set. If only the Start Date and Duration are set, the Computed Start Time cannot be calculated and will not show up in the mobile app (Invalid Date Times can't be queried).
- Date range based on:
- Download all Prospects based on appointments in the date range
- Attachments for the prospects
- Gets all Marketing Opportunities and Lead Sources if they are in the Page Layout under Related Lists
- Download all prospect details for appointments
- Download all Project Activities assigned to the current staff record
- Date range based on:
i360__Public_System_Settings__c.i360__Mobile_Project_Activities_Days_Back__cor defaults to43days - Note: May eventually download Project Activities related to the Sales Rep
- Date range based on:
- Based on Project Activities downloaded, get all related Projects for the needed Project Activities.
- Download all tasks that are:
- Assigned to the current user,
OwnerId/Assigned Tofield AND - That have a due date +/- days user preference OR that is not "Completed" status, where its due date is not set
- Date range based on:
i360__Public_System_Settings__c.i360__Mobile_Tasks_Days_Back__cor defaults to43days - Marketing Opportunities also use this value and Public System Setting for "Mobile Marketing Opps Days Back" is ignored since no Connected App Custom Attribute.
- Assigned to the current user,
- Download Salesforce Standard Events
- Gets events based on OwnerId field but date range.
- Date range based on:
i360__Public_System_Settings__c.i360__Mobile_Tasks_Days_Back__cor defaults to43days
- Download all staff that are
Active- Making a User Inactive may cause "old" staff to show up. When making a User Inactive, be sure the Staff record End Date is set and in the past so the
Activefield is set correctly.
- Making a User Inactive may cause "old" staff to show up. When making a User Inactive, be sure the Staff record End Date is set and in the past so the
- Total number of supported quote template items: 200 (happens via sub-select on Quote Templates)
- Attachments should be downloaded only once and cached
- Downloads attachments for Appointments
- Documents
- Files in Folder Named
- Mobile Docs
- Templates-Quote
- Templates-Sale
- Files Named
- CompanyLogo.jpg
- Note: the file name must be an exact match in order to have company logo downloaded and displayed in mobile app
- CompanyLogo.jpg
- Files in Folder Named