Code Wizard - API is the web-based version of the Code Wizard PowerTool. It gives Encompass administrators one place to write, test, and troubleshoot the code behind business rules, including Field Trigger and Milestone Completion rules. You can draft a rule from a plain language prompt, have an existing rule explained in plain language, test the code against a real loan in a safe sandbox, and see how the rule affects your current rules before you save it.
For the SDK version of this tool, see Code Wizard.
What's New
This version adds three capabilities.
AI-Assisted Rule Drafting
Click Generate and describe the rule you need in plain language. Code Wizard API drafts the rule code in the editor, where you can review it, change it, and test it like any other code. For example, you might enter: "Calculate and set the Rescission Date for a purchase loan when the closing date is entered. If only the estimated closing date is entered, calculate based on that field."
AI Rule Explanation
Paste the code of a pre-existing rule into the editor and click Describe. Code Wizard API analyzes the code and explains what it does in plain language. Use it to understand rules written by someone else, to document rules during an audit, or to confirm what a rule does before you change it.
BizRule Analyzer Integration
Code Wizard API now shows how a rule you are drafting can impact your current rules. Previously, you had to search for a field in BizRule Analyzer Web separately to learn where else it was used. Now the Rule Impact tab shows this inside the tool. You can:
- See which existing rules already use the fields in your draft, grouped by rule category such as Field Triggers, Calculated Fields, and Milestone Completion.
- Spot overlaps with existing logic, such as two Field Triggers that write to the same field, before they cause unexpected results.
- Review an affected rule's logic, then adjust your draft and retest without leaving the tool.
Please note: AI-generated drafts and explanations may be incorrect. Always review the code, test it, and check the impact on current rules before you save.
Prerequisites
Toolshed Portal
Code Wizard API runs in the Lender Toolkit Toolshed Portal. A company admin must have portal access. See Toolshed Portal Access.
PowerTools License
Your LTK PowerTools license must include the Expert, Optimized, or Enterprise tier.
API User and Persona
Because this tool uses the Encompass API, an API user and persona must be set up. See API User/Persona Setup.
BizRule Analyzer
The Rule Impact tab uses the most recent settings data that BizRule Analyzer generates. See BizRule Analyzer Web.
Accessing the Tool
- Log in to the Toolshed Portal.
- Use the Instance ID selector at the top right to choose the Encompass instance you want to work in.
- Open Code Wizard from the portal menu.
How to Use the Tool
Code Wizard API has two areas. The left side is the code editor and its toolbar. The right side is the test panel, which has three tabs: Field Changes, Execution Log, and Rule Impact. Click Guide next to the page title at any time for a quick overview.
[Screenshot: Code Wizard API editor and test panel]
Toolbar
- Optimize: suggests an improved version of the code in the editor.
- Generate: drafts rule code from a plain language description.
- Describe: explains the code in the editor in plain language.
- Format: applies indentation so nested logic is easy to read.
- Copy: copies the code to your clipboard.
- Clear: removes the code from the editor.
- Check Rules: checks your draft against your current rules using BizRule Analyzer. Results appear on the Rule Impact tab.
- Run: runs the code against the selected loan in the sandbox.
Editor
Write or paste your code in the editor. Reference loan fields as [FIELDID], for example [1401] or [724]. Comments begin with an apostrophe.
Testing Your Code
- In the Loan list, select the loan to test against.
- Under Edit Field Values for Your Test, change any Input Value to try a scenario. Each row shows the Field ID, Field Description, Type, Input Value, and the Final Value after the code runs. Click Reset To Default to restore the loan's current values.
- Click Run.
- On the Field Changes tab, review the Prior Value and New Value of each field your code changed. Click Rerun after you change input values to test again.
- Use the Execution Log tab to review how the code ran.
Please note: testing is a sandbox. Loan values are not changed.
Writing a Trigger Rule
The following code sets Loan Program ([1401]) based on Total Loan Amount ([2]):
' Loan eligibility check based on amount and type If Not IsEmpty([2]) Then If Val([2]) > 500000 Then [1401] = "High Balance" Else [1401] = "Conforming" End If End If
- Enter a plain language description of the trigger and click Generate, or write the code yourself.
- Click Format to tidy the code.
- Select a loan, set Total Loan Amount to values above and below 500,000, and click Run each time. Confirm that Field Changes shows the expected Loan Program value.
- Click Check Rules and review the Rule Impact tab (see below).
- Copy the finished code into your Field Trigger business rule in Encompass.
Explaining an Existing Rule
- Copy the code from the existing business rule in Encompass and paste it into the editor.
- Click Describe to read what the rule does in plain language.
- If you plan to change the rule, click Run with different Input Values to confirm how it behaves before you edit it.
Checking Impact with BizRule Analyzer
Use this check each time you draft or change a rule, before you save it in Encompass.
- With your draft in the editor, click Check Rules.
- Open the Rule Impact tab.
- Review the fields in your draft and the current rules that use them. Results are grouped by category, such as Field Triggers, Calculated Fields, Field Data Entry, Milestone Completion, and Alerts.
- Read an affected rule's logic next to your draft.
- Decide whether to change your draft or the existing rule, then click Run or Rerun to retest.
[Screenshot: Rule Impact tab showing affected rules]
Keeping Results Current
The impact check reads the selected BizRule Analyzer settings file. A new file is generated each day when a Super Admin logs in. If other administrators changed rules today, generate a new settings file in BizRule Analyzer Web first, so the comparison includes their changes.
What to Look For
- Shared fields: another rule writes to or depends on a field your draft changes.
- Competing triggers: two rules respond to the same field and may run in an unexpected order.
- Milestone dependencies: a Milestone Completion rule relies on a field your draft updates.
- Alerts: an existing alert uses a field whose value your draft will change.
Notes and Limitations
- Select a loan before you click Run. Testing uses the loan's field values.
- The sandbox never changes loan data. Code Wizard API does not save rules to Encompass; copy the finished code into your business rule.
- AI-generated drafts and explanations may be incorrect. Review and test every result.
- The Rule Impact check is advisory. It is based on the latest BizRule Analyzer settings file and does not replace testing the rule on a loan.
- Always test new or changed rules in a non-production environment before moving them to production.
Please note that Encompass is the system of record for your business rules. Code Wizard API helps you write and review code; you remain responsible for confirming that each rule works as intended.
Still Need Help?
Contact Lender Toolkit Support using the Contact Us link at the bottom of this page.