Pepperi's Rule Engine allows you to embed business logic, calculated real-time, offline into your Transactions. This is a very wide-ranging capability, and requires thought and planning to implement the correct rules and logic.
Some examples of use cases are:
- Alerts and Notifications based on order amounts, quantities, or any other custom caculation - block or alert customers
- Replenishment recommendations - Automatically calculated in the order center based on store stock levels/sell-through/order history
- Rule-based discount policies such as quantity based Price Tiers- Rule-based discounts triggered by customer or item properties.
- Shipping and handling costs - calculation based on weight and volume, separation of shipping charges from total items invoiced.
You can view a live product training webinar which demonstrates step by step how to create and use rules in the Rule Engine on concrete examples here: Pepperi Product Education Webinar - Business Rule Configurator
Rules may be evaluated at any transition in the Transaction and Activity Workflow.
A rule can be either a calculation that is done, a comparison or another check that is made whose result is found to be true or false, or simply a calculated field that is presented in any one of the views or forms. Based on the evaluation of the rule, actions can be taken, discounts given, totals and quantities can be modified, etc. Depending on what the purpose of the rule is.
Based on the results of the rule, you may block the ability to submit the Transaction/Activity or just display a notification for the user with a message you define.
The Rule Engine is available with the Pepperi Ultimate Package. If you are not subscribed to this package and would like to use the rule engine please contact us.
This article will provide a general overview of how to implement rules by following these steps:
1. Create the Custom Field to be evaluated.
2. Edit the workflow of the Transaction Type to include an action that validates the rule.
3. Check that your Custom Fields are being evaluated correctly
After reading these general overview steps, you can read a step by step example of setting up a rule to Enforce Minimum Order Amount and Amount Eligible for Order Discount.
Rules are configured per Sales Transaction in the Settings -> Sales Activities -> Transaction Types.
1. Create the Custom Field to be evaluated
A calculated custom field is the rule that will be evaluated and determine if notification is displayed and/or the order is blocked, or simply calculate the value of a field.
To create a calculated custom field go to the Fields tab and add a "Custom Field".
There are several types of custom fields that may be calculated, by a formula or calculated from values in User Defined Tables.
Custom fields can be either:
Transaction Custom Fields - fields that evaluated at the header level of the order
Transaction Line item Custom Fields - fields evaluated for each line-item (each item in the order center)
This example shows a Transaction Custom Field of type checkbox (boolean) - meaning a calculated field that is evaluated to either true or false.
Click on Custom Transaction Fields -> Add Custom Field
Select "Checkbox" from the field types on the left.
Select the Calculated Field button on the top of the window.
Field name - The name of the Custom Field
File API Name - will be automatically filled in identical to the Field name (used when data is exported from Pepperi to your ERP)
Field Mapped Name - the name of the field heading you will use if you upload values from an external system into Pepperi for this field.
Formula - enter the formula used to calculate the field in Java Script syntax:
Click on Edit to write the formula that will be evaluated.
The formula contains operands, numeric values, operators, evaluators and booleans.
The operands are fields from the list of Pepperi Transaction fields. If you have imported your own User Defined Tables of data to Pepperi you may use the data imported as operands. You are not limited to the Pepperi fields.
Click on "+" to select the Available fields you will need in your formula from the list of fields.
Once you have written your formula click Save.
2. Edit the workflow of the Transaction Type to include an action such as an alert or stop condition, and select that rule to be validated.
Go to the Workflows tab of the Transaction Type.
Edit the Transition for which the rule should be evaluated - ie:
New -> In Creation / In Creation -> Submitted / any other transition you have created in your Workflow
Add an action that will evaluate the rule.
Edit the Transition
Select an action that is based on the result of the rule you created. For example:
- Alert on Condition
- Stop Condition
- Branch Condition
For example - the "Alert on Condition" will pop up a notification based on the evaluation of the rule:
3. Check that your Custom Fields are being evaluated
It is recommended you check that your Custom Fields are being evaluated correctly, and actually getting the values required.
To do so, add them to the layout of the Transaction Header, and you'll be able to see their calculated values to troubleshoot any issues with your formulas.
Go to the Views and Forms tab of the Transaction, open the Header form.
Edit the Sales Rep Header Form to include the advanced custom fields that you created.
You can drag them to the bottom of the layout temporarily while you are checking your rules. Once your rules work you can remove them from the layout.
To see the fields, sync Pepperi, create a test order and go to the cart and tap on "More.." and view their values on the Order Details form.