Code Wizard is a powerful Encompass Plugin that facilitates the writing of business rules by providing syntax highlighting, error checking, autocomplete, autoformat, loan simulation, and a library of common functions. It can help Encompass Administrators as their code grows and becomes more complex to meet business requirements.


1.    Installation of the Code wizard tool is done through the Toolshed Plugin under the Expert and above tiers.  Ensure that the Code Wizard tool is licensed through Toolshed before continuing.
2.    To activate the plugin, in the ToolShed Settings window, turn the Code Wizard on and obtain license code.

3.    ToolShed will download and install the current version of the package.
4.    Restart Encompass to complete the installation.

Instructions for Use

1.    The installation adds a Code Wizard button when there is custom field code, rule filter code, or advanced code in a business rule.

2. Clicking the button opens the Code Wizard editor. 

    It is strongly recommended to have a loan open prior to launching the Code Wizard.
    The Test feature will not be available without a loan open.

3.    Below is a screenshot of the Code Wizard for a filter on a Trigger rule.
       The left pane shows the code for the filter or advanced code.
       The right pane displays the current loan values for fields used in the code.
       It also can be used to test the code, look up the syntax for functions, find other custom code in Encompass, and to simulate the code without changing the actual loan data.
The code in the left pane is the actual code for the field or rule.  Changes to this code will be saved to the field or rule.

Image Placeholder

1.     The name of the Business Rule being edited.

2.    Auto Format – button to auto-indent the code, making it easier to understand the logic, branching, and nesting.   See examples below.

3. Check for Errors - After making changes, click to check for misspellings, missing or extra parentheses, etc.   See examples below.

4.     Strong Check - Leave Strong Check selected.  Displays an error if fields are used with wrong functions for the field data type. 
I.e. [4000].AddDays(1), [#2].StartsWith("Test") or [@763].Contains("Test”).

5.     Strict Check - only use if working with SDK/PlugIn code.

6.    Test - click to simulate how the code would run and the results for the current loan data.
See examples below.

7.     Help – displays help with the various sections of the Tool.

8.     Field Values – displays the values of fields in the code from the currently open loan.  If there was no loan open when the Tool was launched, each field will display “No Loan”.

9.     Functions - Searchable List of ~ 200 standard functions. 
I.e. InStr(), DateDiff(), XdateDiff(), IsEmpty(), IsDate(), LCase(), UCase(), Milestones.SetComplete(), etc..

10.  Other Code - Searchable List of code from other Biz Rules in the same category (i.e. Calculations, Field Triggers, Field Data Entry, …). 
Code can be easily copied from this list to be used in the current field or rule.

11.  Simulator – if a loan was open when the Tool was launched, current field values are displayed.  Field values can be changed for testing without affecting the actual field values in the current loan.

12.  Reset – resets the Simulator field values to the current values from the loan.

Using Test / Simulator

The Testing mode, using the Simulator is an extremely powerful feature of the Code Wizard.  It can save Administrators hours when developing and testing calculated fields, rule filters, and advanced code in business rules. Without this feature, an administrator may need to create a custom form with the new calculated field, and change the loan values, save, close, reopen the loan to test various scenarios.  The Simulator allows the administrator to test various scenarios without affecting the actual values in the current loan.

Below is an example of a custom calculated field that compares the current Mortgage Insurance amount to the amount that was previously disclosed, which was stored in another custom field.  If there is no previously disclosed amount, the field should evaluate to “NA”.  If the amounts match the field should evaluate to “Unchanged”, otherwise it should evaluate to “CHANGED”.

Scenario 1 – No previously disclosed MI. 

The Simulator shows that the field would evaluate to “NA”.  This is expected because [CX.MI.DISCLOSED] is zero.
Image Placeholder

Scenario 2 – Current MI matches the previously disclosed amount. 

The field should evaluate to “Unchanged”. 
Image Placeholder

1.     Admin changes [232]

2.     Admin changes [CX.MI.DISCLOSED]

3.     Admin clicks the “Run Calculation Code” button

4.     “Calculated Value” displays the result, “Unchanged”, as expected.

Scenario 3 – MI amount changed

Image Placeholder

1.     Admin changes [232]

2.     Admin clicks the “Run Calculation Code” button

3.     “Calculated Value” displays the result, “CHANGED”, as expected.

By using Code Wizard to author and test the above scenarios, the administrator is able to test various combinations of values without changing the actual data in the loan being used.  If an error is discovered, the administrator can change the code in the left pane and immediately test it in the Simulator. This can save multiple hours when designing complex code with a large number of variables.

Auto Format Code

Auto Format Code makes code significantly easier to read.  Unformatted Encompass code can be difficult to analyze.  Formatting helps with assessing the logic flow of the code.

Field Calculation and Biz Rule Condition code is also split into multiple lines with proper indentation which adds extra clarity.

Example of formatting and checking Field Calculation Code:

Image Placeholder

Image Placeholder

Checking for Errors

Check for Errors compiles the code to see if any errors are reported by the code compiler.  If there are no errors, you will see a “Success” message.  Otherwise, an error list is displayed.  You can click on any error in the list to see the line which failed.

This is especially useful with Auto-Formatted Field Calculation and Condition Code.  Whensuch calculation code is split into multiple lines, this will lead you to the actual part which contains the error as opposed to a generic error message displayed by Encompass.

Image Placeholder

Image Placeholder

Use of Intellisense to autofill fields and enumerations

IntelliSense is a utility that aids an administrator when authoring calculation coding. IntelliSense is invoked when you start typing ‘[‘.  A list of fields already in the code is displayed.  At the end of the list appears “Find Fields” which allows searching fields by keywords.  If a field has options, they will be presented in another IntelliSense prompt after pressing ‘’.  Examples below:

Image Placeholder  Image Placeholder

IntelliSense is also helpful for Global functions such as InStr(), CStr(), Trim(), …

This product installs the following to Encompass: