Skip to main content
Skip table of contents

Setting up Business Rules

Business rules let you define extra conditions that guide employees or restrict the submission of expenses. They help enforce company policies and reduce errors in reporting.


Types of Business Rules

Blocking (red): a report containing these expenses cannot be submitted.

Warning (yellow): the report can be submitted, but the employee receives a warning.

Informative (blue): the report can be submitted, but the employee sees extra information or a reminder.

When to Use Which Rule

  • Use a blocking rule for hard limits, such as a maximum amount per expense, per category, or per report.

  • Use a warning rule to alert employees, but still allow submission.

  • Use an informative rule for reminders or additional guidance.

Configuring Business Rules

Business rules are defined using a script that checks properties of an expense or report.

When creating a business rule:

  • Explanation field: Add the message that will be shown to the user. Make it clear, so employees understand what is wrong and whether they can fix it.

  • Type: Choose whether the rule is blocking, warning, or informative.

  • Group: Apply a rule to all employees, or limit it to specific groups.

Examples of Business Rules

Category-Based Rules

CODE
bill.value > 25 && bill.category.code == '4021'

This rule triggers when an expense is higher than €25 and the chosen category has code 4021.

CODE
bill.value < 25 && bill.category.code == '4021'

This variation triggers when an expense is lower than €25 in category 4021.

Multiple Categories

CODE
bill.value > 100 && bill.category.code in ['100', '200', '700']

This rule triggers when an expense is higher than €100 and belongs to categories 100, 200, or 700.

Maximum Amount per Period

CODE
bill.category.code == '135' && DAYAMOUNT(bill.getCategory()) > 62.50

This checks whether the daily total (DAYAMOUNT) of category 135 exceeds €62.50. Other available totals:

  • DAYAMOUNT = daily total

  • MONTHAMOUNT = monthly total

  • YEARAMOUNT = yearly total

Custom Field Rules

CODE
bill && bill.getFieldData('costcenter-2') && ISATTRIBUTE(bill.report.bills, "getFieldData('costcenter-2')", '!=', bill.getFieldData('costcenter-2'))

This rule checks whether all expenses in a report have the same value in the custom field 'costcenter-2'. If not, the rule is triggered.

Expense Age

CODE
DATEDIFF(bill.expenseDate, 'now', '%r%a') > 180

This rule blocks expenses older than 180 days. Useful when employees must submit expenses within a certain timeframe.


Using Fields to Identify Categories/Projects in Business Rules

When checking categories or projects in a business rule, you can use different fields:

  • Code field

In the examples above, the category’s Code field is used. This is in most cases the most reliable option. If the same code is used across multiple categories, you may need to fall back on Code2, Code3, or Code4

  • Code2–4 fields

These fields are often unused for ledger or payroll codes, which makes them ideal for custom references (e.g., internal mappings).

  • Name (not recommended)

You can check against the category or project name, but this is not recommended. Names are easy to mistype and often change, which can break your rules.

Need Help?

Business rule scripts are flexible and can be tailored to your organization’s policies. If you need help setting up or testing rules, please contact our Support Team.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.