Changes

Jump to navigation Jump to search
no edit summary
Line 6: Line 6:  
The option to execute scripts directly from rules combines these two options. It aims to simplify writing JavaScript for Mobile CRM by removing the need for boilerplate code, and it should open path for creating reusable JavaScript libraries with additional functionality for Resco mobile apps, e.g., additional math, date, or string operations, and also business logic.
 
The option to execute scripts directly from rules combines these two options. It aims to simplify writing JavaScript for Mobile CRM by removing the need for boilerplate code, and it should open path for creating reusable JavaScript libraries with additional functionality for Resco mobile apps, e.g., additional math, date, or string operations, and also business logic.
   −
For now, this option is supported for form rules
+
{{Note|For now, this option is supported for form rules. Do not attempt to use the ExecuteJS function in other rules, for example, in views.|Warning}}
    
== Offline HTML ==
 
== Offline HTML ==
   −
Some prep work is necessary in the [[Offline HTML]] section of Woodford. TBD
+
In the [[Offline HTML]] section of Woodford, you need to add the following:
 +
* JSBridge.js (the file provided by Resco that contains the method to execute JS desired function from Woodford rule editor)
 +
* An HTML file with scripts. An example of such a script is available below.
   −
== Adding the function calls to rules ==
+
== Add function call to form rules ==
   −
TBD
+
# Edit a [[form]] in Woodford.
 +
# Click '''Add IFrame''' and link to the file script that you uploaded to the offline HTML folder in the previous section.
 +
# Next, open the rules editor for an event, for example '''On Save'''.
 +
# Create a new variable and use the operation ExecuteJS.
 +
 
 +
[[File:Sample executejs rule.png|600px]]
 +
 
 +
== Additional information ==
 +
 
 +
* The serialized MobileCRM.UI.EntityForm object is automatically passed as a parameter to the function. You cannot pass a custom input parameter.
 +
* The operator ExecuteJS is supported only for variables of the following types: Boolean, String, Integer, Double, Float, Decimal, Money, DateTime, StringList, Entity, Lookup.
 +
* The implementation supports also ''promises'' for asynchronous result return from functions.
    
== Example ==
 
== Example ==

Navigation menu