The Mobile CRM Conference 2015 September 14-15, 2015 in Boston, MA Take Your CRM to the Next Level
A to Z of portable business logic Technical Advanced Track Juraj Mojik
Validate address, postal code, telephone number Time duration is calculated (Actual End – Actual Start) A field is hidden / not editable based on a condition Populate fields on a child entity based on the parent Modify the Order Products to add a special discount Find out how many appointments have been made against an Account …
All business logic captured within JavaScript Workflows UI scripts … has to be rewritten (recreated) for Mobile CRM Data plugins will fire Upon synchronization Immediately in Online mode
Rules Form View Calendar & Map JavaScript Form HTML UI components
Mobile application scripts written directly in Woodford Form Events Commands View Calendar Map
Conditions (if …) Steps Assignment Get GPS Position Say Text …
Available on Edit Form Executed on Form events / actions 3 types onLoad onChange onSave Specialty – onChange is executed during loading Value is changing from nothing to something
Triggered when the form is loaded (form is opened) Typically: Initialization of values Initialization of the form Specialty isFormEditable – makes whole for not editable
Triggered when a field on the form has changed Typically: Validation checks Setting of values Items visibility Specialty ChangedItem – contains currently changed item IsLoaded – if the form has finished loading
Triggered when the form is being saved Typically: Final check before saving Specialty ErrorMessage – prevents saving WarningMessage – user decides whether to save or not Note – setting values in Save is ignored
Entity – entity fields (data) Form – items available on the detail tabs Tabs – all the tabs Variables – local variables Shared variables – variables shared between the rules Configuration – current user, URL, is online, … Relationship – if form opened via associated view Specialties
Account, Don’t Allow s field If Don’t Allow s Make field not available on the form
Address on the Contact form Don’t allow saving a contact with incorrect address Inform the user with a message Highlight the problematic field
Contact has parent Account (parent company) Show Account’s website on the Contact form The field should be not editable Change is not reflected on the parent
Setting a value in the onChange rule triggers the onChange rule again! ‘field = value’ will trigger onChange Execution stops when the same value is being set onChange isn’t called when new value is the same as original value Typical problem – DateTime.setNow
Define commands (actions) for form Can use predefined Change State & Status Delete link Favorite PrintReport Scan (Contact, Lead) Conversions Or define own custom command
On Execute What should happen when a command is executed On Can Execute When a command should be available Command.isEnabled Script the same as on Form rules Both scripts can control standard & custom commands
Contact – Parent Account Custom command : Copy Address From Parent Should copy Address fields Available only if Address fields are empty
Contact Delete Status Field (Active / Inactive) Only show delete command if Contact is inactive
Similarly to Form rules there are also View rules View rules can set Row template Variable – ‘virtual item’ Modifying entity properties won’t work!
View - multiple row templates Different rows (lines) different look Row script (view rule) Which row template is used TemplateIndex Which template to use for current line
Opportunity view Different look for different Opportunities Highlight the ones with revenue more than $
Row definition contains Map pin Flip view to map Global Map Map pin requires Latitude & Longitude View rule is respected on the map Different pins for different items
The same Opportunity view Show Opportunities on a map based on their Account address Different Pin different revenue
Color of items (Color property) Possibility to reschedule by drag & drop (IsReadOnly) Note! Entity object contains all the properties If you want to use some – must be enabled in Select Fields
Standard Calendar Appointments Priority field Show Calendar items in Red if priority high Green if normal Blue = low
Form Events onLoad onChange onSave Commands onExecute onCanExecute View & Map Calendar
Access entity values Access form / view / calendar properties Load parent entity (via lookup) Create variables & show them Access GPS Access configuration Display a Message …
Load children entities (for cycle) Execute fetch (retrieve records) Create, modify & save entities (except on form)
Load children entities (for cycle) Execute fetch (retrieve records) Create, modify & save entities Access metadata Create (local) files …
What is Offline HTML? Flexible way to extend MobileCRM Offline HTML HTML pages (.html,.js,.css,.jpg, *) Included into Mobile Project Available offline for mobile app Offline HTML is used for Extending the Mobile CRM app UI Adding business logic Replacing the app’s UI completely
Offline HTML in Resco Mobile CRM The HTML pages are displayed in a web browser window (IFrame) Uses device’s browser iOS – Safari Android – Chrome Windows – Internet Explorer The IFrame can be placed on Form (as tab) Hidden – not visible Containing only business logic
Resco JavaScript Bridge JSBridge.js - Component provided by Resco Allowing the HTMLs (JavaScript) to interact with Resco app Native UI Data Layer (Fetch, Entities) Other (Application, Configuration, Metadata, …) You have to include it in your HTML / JS Latest version available always here Comprehensive reference of all functions & classes
Architecture Resco JavaScript Bridge Local DB … & more
1.Create an HTML page with business logic in JavaScript 2.Add that page as IFrame (tab) on a form 3.Make the IFrame hidden Work with: onChange, onSave handler onLoad – not present (body onload) CreateCommand, onCommand, CommandEnabled
Dynamic Entity represents entity instance createNew, load, save, properties[“fieldname”] FetchXML for queries construct, execute & process results EntityForm for form interaction onChange, onSave, form items, form properties, …
Do you need to: Load multiple records Create, modify & save records Perform computation on arbitrary number of fields Process strings (extract part of a text field) Go for JavaScript bridge Everything else -> start with Rules
Limited inter-form / multi-tab communication Not available on views / lists No global object Asynchronous everywhere! JavaScript Bridge objects different to Dynamics CRM
Thank you. Help us improve! Rate this session in the resco.next app TAKES 1 MINUTE