# Rules Applied

### General

Your company policies and procedures are likely unique.  In an effort to help automate as much of your company’s processes as possible, LoanPro provides the Rules Applied feature.  So, what is Rules Applied?  This is a way you can create your own list of conditions and then specify how a loan should change when a condition is met.  There are three things that need to happen in order for a loan to change based on a rule.  This article will cover those three things.

Restrictions — Rules Applied will only run on Live accounts. By default they run on Activated accounts, so if the account is not activated (there are some dependencies of activation, including the loan is setup (has values saved on it), you must specify that the rule can run prior to the activation.

Note: You cannot use a computation field in a rules applied rule. If you have a computation field that you'd like to use, you should copy the logic of that field into the rule. The reason for this is that referencing a computation field in a rules applied rule significantly slows the system down. Because the system evaluates so many rules, even a small increase in the time it takes to evaluate each rule makes a big difference.

Let’s say that your company policy is that as soon as a loan has a payoff amount of $0.00, the loan status should be changed to paid off. The next three sections will show how this can be accomplished. #### Create a Rule LoanPro uses the Clojure (pronounced like closure) language in order to create rules. We do this for several reasons. First, Clojure is a language that already existed and there are many online resources that can teach you about how to write a Clojure rule. Second, Clojure complies to Java and so it’s a language that can run efficiently on our servers without the need for a custom-built compiler (nerd language for a program that reads a programming language and turns it into something your computer can understand). There are several articles in this help system that will instruct you on how to write a rule. In order to use rules applied, first you need a rule. In our example, the rule should be: payoff =$0.00.  Now we need to convert that to a rule that LoanPro can understand.  We’ll start by navigating to Settings > Company > Rules Manager within your company account.

Click  to add a new rule.

First enter a name for the rule in the Name field.  Next, select True/False Output from the Category drop-down menu.  We’ll make this selection since we want the rule to evaluate to either true (the loan is paid off) or false (the loan is not paid off).

Enter the new rule into the formula box provided.

Our rule will be (<= status-payoff 0).  The <= is a logical test to see if the first number, in this case the status-payoff variable, is less than or equal to the second number, 0.  We found the status-payoff variable by typing payoff into the search field.

Now you can save the rule by clicking . To validate any rule you entered, click Validate this rule. This will ensure that your rule uses correct  Clojure syntax.

#### Apply the Rule

Now that we have our rule created, we need to tell the system what to do with a loan once this rule is met.  To do this, we will first navigate to Settings > Loan > Rules Applied > Loan Settings.  There are several tabs under the Rules Applied tab.  As specified in the example, we want the status of a loan to change when our rule is met.  Since loan status is a  loan settings item we chose the Loan Settings tab under the Rules Applied tab.  If we wanted a different action to be taken when our rule was met, we may have chosen one of the other tabs.

Click  to enter the new rule application.

You have many options on this page.  This is simply because you can change any of the loan settings when a rule applies.   First, enter a name for the rule application so that you will be able to distinguish it from the others.  Something like ‘Change status to Paid Off when Payoff is \$0.00’.  Click Empty in order to apply the rule we created.

Now click Load Existing Rule in order to add the rule we already created. Find the rule we created (Loan is Paid Off) and click Insert in the last column of the rule’s row.  This will add the rule to the formula editor.  Now click Save in order to add that rule to the rule application.  Now you can choose which loans this rule application will apply to and when the rule will be evaluated.

If you want the rule application to be active on new loans going forward, click the “Add To New Loans” checkbox. If you would like the rules applied to be executed prior to activating the loan, check the "Preactivation Loan" checkbox: if left unchecked, the rules applied will be executed after the loan has been activated. Use the “Evaluate In Real Time” and “Evaluate In Daily Maintenance” checkboxes to choose whether rules should be evaluated when changes are made to the loan, when  daily maintenance runs, or both.

Now we will designate the actual change that needs to occur. You have the option to change any of the loan setting values or custom field values. This includes adding or removing portfolios, setting dates or other values.

When you choose to set a date or numeric value, you can choose a base date or number, that your change will be relative to. You can choose any of the following as the base date:

• Current Date
• Next AutoPay Apply Date
• Next AutoPay Process Date
• Loan Creation Date
• Last Human Activity Date
• Date Last Current
• Final Payment Date
• Original Maturity Date
• Insurance Start Date
• Insurance End Date
• Last Payment Date
• Next Due Date
• Next Scheduled Payment Date
• Closed Date
• Liquidation Date
• Repossession Date
• Contract Date
• First Payment Due Date
• Subsequent Due Date

So, for example, if you choose to change the "Closed Date" for the loan, you could choose to set the closed date relative to the Liquidation Date. After you choose the base date, you can enter an integer value that equals a number of days away from the base date. A negative integer will give a final date that is previous to the base date, and a positive integer will give a date after the base date. So, if the Liquidation Date is 01/01/2019 and you enter 10 as your integer, the final date will be 01/11/2019.

Note: If you choose a base date that doesn't have a value, by default the current date will be used as the base date. For example, if the base date used is Next AutoPay Apply Date but there is no AutoPay on the account, then the field will instead use the current date.

Numbers work in the same way. the following base numbers are available:

• Base Zero
• Amount Past Due
• Principal Balance
• Payoff
• Due Fees
• Due Principal
• Due Interest
• Due Escrow
• Payoff Fees
• Remaining Interest
• Total Credits
• Next AutoPay Amount
• Available Credit
• Last Payment Amount
• Next Payment Amount
• Total Loan Amount
• Underwriting Fee
• TIL Finance Charge
• TIL Total of Payments

Finally, click Save in order to save the rule application.

If you want to enroll all of your existing loans in the rule application, click  subscriptions on the main screen for the rule application you want to enroll loans for.

#### Applying the Change

Your work is done at this point, but it’s useful to know when your rule will be evaluated by the LoanPro system.  There are three times when a rule may be evaluated by LoanPro: when loans are updated daily, when events occur on the loan, or when you choose to force a rule.

Daily Update – LoanPro updates all live loans on a daily basis.  This is done to compute interest accrued on the loans, update numbers for payoff, record data for specific reports, add automatic fees, etc.  Rule application will be applied at this time and any necessary changes to loans will be made.

Loan Events – Loan events like the logging of a payment or fee, the adjustment of past-due balance, etc. can also trigger the evaluation of a rule application.  This will only happen if the Evaluate In Real Time checkbox is filled in inside the rule application.

Force – You may force a rule for a single loan by clicking "Force Rule" in Rules Applied inside the appropriate loan tab. For our example, you could force the rule application for a specific loan by navigating inside of the loan loan to Rules Applied > Loan Settings and then selecting and then "Force Rule". If the account meets the correct rule criteria, the necessary changes will be applied.