Expense condition nodes

Only account admins can perform this task.

Some condition, activity, and approval nodes may be restricted to Premium or Pro plans. Your company must have one of these plans to incorporate them in your workflow.

Condition nodes include conditional clauses for performing the next step in the workflow. The workflow designer offers these notes for managing expenses:

True/false condition

Configure a true/false condition based on specific business rules that you determine in JSON format. For example, you can use this condition to check if an expense is a receipt or a no-receipt expense, if it is a credit note, etc.

In this case, this condition returns:

  • True: The JSON-specified condition is met (i.e. the property is present on the expense).
  • False: The JSON-specified condition is not met (i.e. the property is not present on the expense).

Note: The True/False condition checks for attributes saved on the expense (such as custom fields). If you need to check attributes on the object itself, such as whether a custom field has been selected on a tag dimension, use the Custom true/false condition.

JSON rules

You can build complex business rules and serialize them as JSON. The JSON rules are specified in the Rules field of the node options.

These operations are supported:

Accessing data var, missing
Logic and Boolean operations if, ==, ===, !=, !== , ! , !! , or , and
Numeric operations > , >= , < , <=, max, min, +, - , *, /, %
Array operations map, reduce, filter, all, none, some, merge, in
String operations in, cat, substr

For example, you can:

Check for custom field on expense

You can set up a rule to check if there is the customInformation.field value and it is equal to true. If so, it returns true.

  1. Identify the custom information field in the company, if not already set up by Perk.
  2. Then add a true/false node and copy and paste this snippet into the Rules field:
     

    {
      "==": [
        {
          "var": [
            "customInformation.<CustomFieldLabelName>"
          ]
        },
        true
      ]
    }
  3. Set up the workflow in the company.

Note: Custom information fields can only be set up by Perk. You may need to open a support ticket if the custom information field you require doesn‘t already exist in your Perk implementation.

Check if expense is receipt

You can set up a rule to check if the expense is a receipt one. If so, it returns true.

Add a true/false node and copy and paste this snippet into the Rules field:

  {
  "in": [
    {
      "var": "expenseType"
    },
    [
      "receipt"
    ]
  ]
}

Check if expense is no receipt expense

You can set up a rule to check if the expense is a no receipt expense. If so, it returns true.

Add a true/false node and copy and paste this snippet into the Rules field:

{
   "in":[
      {
         "var":"expenseType"
      },
      [
         "receiptless"
      ]
   ]
}


Check if expense is assigned to a trip

You can set up a rule to check if the expense has been assigned to a trip. If it is assigned to a trip, it returns true.

Add a true/false node and copy and paste this snippet into the Rules field:

{
  "!=": [
    {
      "var": "tripId"
    },
    null
  ]
}


Check if expense without warnings

You can set up a rule to check if the expense has no notifications/warnings. If it doesn’t have any notifications, it returns true.

Add a true/false node and copy and paste this snippet into the Rules field:

{
  "==": [
    {
      "var": [
        "notifications.0"
      ]
    },
    null
  ]
}

Check if the expense is a travel expense

You can set up a rule to check whether an expense has Perk as provider. If so, it returns true.

{
   "==":[
      {
         "var":[
            "travelProvider"
         ]
      },
      "travelPerk"
   ]
}

Check if the expense has one of two categories selected

You can set up a rule to check whether an expense has either one category or the other selected. Perk checks both single category expenses and expenses with multiple categories by using the variable splitcategories.0.categoryId.

Note: You must change the category Perk ID to the ones you want. Otherwise, this example does not work.

{
   "or":[
      {
         "in":[
            {
               "var":"categoryId"
            },
            [
               "GxjPfl9gGX",
               "4QYutTYGSg"
            ]
         ]
      },
      {
         "in":[
            {
               "var":"splitCategories.0.categoryId"
            },
            [
               "GxjPfl9gGX",
               "4QYutTYGSg"
            ]
         ]
      }
   ]
}

Custom true/false condition

Configure a true/false condition based on specific business rules that you determine in JSON format. For example, you can use this condition to check whether a custom checkbox field has been selected for a tag dimension.

In this case, this condition returns:

  • True:
    • The JSON-specified condition is met.
  • False:
    • The JSON-specified condition is not met.

Note: While the Custom true/false may appear similar to the True/false condition, it can “drill down” on objects that are present on the expense. 
The True/false condition checks data that is indicated on the expense (such as a custom field, value, etc.), while the Custom true/false is able to is able to pull other data. For example, it can check the cost object that the expense is assigned to and check the logic.

You can build complex business rules and serialize them as JSON. The JSON rules are specified in the Rules field of the node options. You can perform this “drill down” for multiple objects:

  • Tag dimensions
  • Cost objects
  • Legal entity
  • Categories
  • User

For example, you can:

Check that custom field is flagged on tag value

You can set a rule to check if on the tag dimension with a specific Perk ID, the custom information checkbox is equal to true (i.e. selected). If so, it returns true.

  1. Identify the custom field in the company on the tag (it may need to be set up by Perk). The label field value (CustomFieldLabel) MUST be specified in the expression below.
  2. Add a true/false node and copy and paste this snippet into the Rules field:
     

    {
      "==": [
        {
          "var": "_tags.YOKOYID.customInformation.<CustomFieldLabel>"
        },
        true
      ]
    }
  3. Set up the workflow in the company.

Note: Custom information fields can only be set up by Perk. You may need to open a support ticket if the custom information field you require doesn‘t already exist in your Perk implementation or if you don’t know the name (which may or may not be the same as the label shown in the app).

Check if submitter is custom field approver

You can set a rule to check for a custom field with a specific Perk ID, the approvers on that custom field array are equal to the submitter user.

Add a true/false node and copy and paste this snippet into the Rules field:

{
   "in":[
      {
         "var":"userId"
      },
      {
         "var":"_tags.<PerkTagDimensionID>.approverIds"
      }
   ]
}

Caution: Make sure to change <PerkTagDimensionID> with your custom field ID.

Check for category custom field on the expense

You can set a rule to check if on the category submitted on the expense, the custom information checkbox is equal to true (i.e. selected). If so, it returns true.

  1. Identify the custom field in the category (it may need to be set up by Perk). The label field value (CustomFieldLabel) MUST be specified in the expression below.
  2. Add a true/false node and copy and paste this snippet into the Rules field:
{
  "some": [
    {
      "var": "_categories"
    },
    {
      "==": [
        {
          "var": "customInformation.<CustomFieldLabel>"
        },
        true
      ]
    }
  ]
}

Note: Custom information fields can only be set up by Perk. You may need to open a support ticket if the custom information field you require doesn‘t already exist in your Perk implementation or if you don’t know the name (which may or may not be the same as the label shown in the app)

Amount validation (expense)

Configure a true/false condition (guard) if the expense meets an amount condition. For example, you set up the logic to tell Perk if the expense is between 10 and 100 CHF to skip the approval flow and go to In review. Otherwise, perform a tag approval flow.

In this case, this condition returns:

  • True:
    • The amount condition is met.
  • False:
    • The amount condition is not met.

This specific condition comes with different options:

Option Accepted value Description
Aggregation type Single or Day
  • Single: compare against the threshold on a expense-by-expense basis
  • Day: aggregate all expenses within the same calendar day
Operator >, >=, <, <=
  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than (<)
  • Less than or equal to (<=)
Currency String Currency taken into consideration. 
Use ISO 4217 3-digit code.
Threshold amount Number Amount for the validation. 
For example, if you set 100, all expenses that are above, below or equal to this amount depending on the chosen operator.
Normalize by number of participants true / false If you select this checkbox, Perk checks for the number of participants and divides the expense amount for the number of users that are sharing the expense.

For example, you set up the logic to tell Perk to check if the expense is more than 150CHF (not divided by number of participants). If the expense is more than 150, it returns true.

The aggregation type determines whether a cumulative total is taken for the day or whether each expense is to be checked individually. This is used in scenarios where employees have a daily allowance. For example, for employees with a daily allowance of 40 CHF for lunch, if the single aggregation type is selected in the node, two lunch expenses of 30 CHF return a true to the condition. If day aggregation type is selected and two lunch expenses of 30 CHF are submitted, the second expense results in a false response.

Amount validation (category)

Configure a true/false condition if the logic applies. Unlike Amount validation (expense), this condition checks the amount on each expense category. The threshold amount is defined on the category itself, as a custom field, rather than within the condition node.

For example, you set up the logic to tell Perk if the sum of the expenses for the category are between 100 and 500 CHF to skip the approval flow and go to In review. Otherwise, perform a tag approval flow.

In this case, this condition returns:

  • True:
    • The amount condition is met.
  • False:
    • The amount condition is not met.

This specific condition comes with different options:

Option Accepted value Description
Aggregation type Single or Day
  • Single: compare against the threshold on a expense-by-expense basis
  • Day: aggregate all expenses by category within the same calendar day
Operator >, >=, <, <=
  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than (<)
  • Less than or equal to (<=)
Aggregation logic any, all
  • All: Perk checks for all categories on the expense. If ALL categories respect the condition, it returns true.
  • Any: Perk checks for all categories on the expense. If any of the categories meet the condition specified, it returns true.

Categories that do not have a threshold defined are ignored.

Normalize by number of participations true / false If you select this checkbox, Perk checks for the number of participants and divides the expense amount for the number of users that are sharing the expense.

Set up custom fields for category amount validation

To use this condition, you need two custom field for expense categories:

  • customInformation.thresholdCurrency : the currency of the threshold (CHF, EUR, etc.)
  • customInformation.thresholdAmount: the amount of the threshold (50, 100, etc.)

These custom fields may need to be set up by Perk first. You need to enter thresholdCurrency and thresholdAmount as the Names in the custom field setup.

Name Label Type
thresholdAmount Threshold amount Text input
thresholdCurrency Threshold currency Text input

Note: Custom information fields can only be set up by Perk. You may need to open a support ticket if the custom information field you require doesn‘t already exist in your Perk implementation or if you don’t know the name (which may or may not be the same as the label shown in the app)

This step needs to be done for each legal entity where you want to use the workflow with the Expense category amount validation node.

The threshold amount is set directly in the Category configuration. It applies to expenses submitted for that category and depends on the aggregation type (single/day), operator, and logic set up in the workflow.

Amount validation (trip)

configure a true/false condition (guard), in expenses with trips, to check whether the total claim of the trip exceeds the defined threshold (in the legal entity currency). For example, you set up the logic to tell Perk if the trip amount is more than the threshold specified.

In this case, this condition returns:

  • True:
    • The amount condition is met. The trip total claim is greater than the threshold amount.
  • False:
    • The amount condition is not met. The trip total claim is less than the threshold amount.

This specific condition has one option:

Option Accepted value Description
Threshold amount Number

The threshold amount for the validation. This amount is compared with the total trip claim. For example, 100.

The currency is taken from the legal entity.

Tax rates incomplete

Configure a true/false condition to determine if the document has been assigned a tax rate and whether the tax amounts extracted from the expense are correct.

  • True: If the tax code is incomplete or the sum of the tax amounts is incorrect, it returns true.
  • False: If the tax code is complete and the sum of the tax amounts is correct, it returns false.

For example, if an expense has taxes (with or without split categories) but the tax code is missing or the gross tax amounts do not add up to the total claim, it returns true.

The node includes two options:

Option Accepted values Description
Exclude zero tax rates true / false If selected, Perk does not consider zero% rates as “eligible rates”.
Return false for allowances true / false If selected, Perk ignores allowances.

By default, Perk considers zero tax rates to be an eligible tax rate and returns false if an expense has a zero tax rate selected. You can override this behavior by selecting the Exclude zero tax rates checkbox, which means if an expense has a zero tax rate, it returns true.

In addition, you can exclude allowances (per diems) from this tax rate check since allowances do not usually contain tax.

Submission to own cost objects

Set up a condition that returns true/false if the expense’s cost object is the same as the submitter’s cost object. In this case, this condition returns:

  • True: The owner of the cost object assigned to the expense is the same person who submitted the expense.
  • False: The owner of the cost object assigned to the expense is not the same as the submitter user.

For example, an expense is submitted by the user Alex Smith and assigned to the cost object “Manufacturing”. The owner of the manufacturing cost object is Alex Smith. In this case, Perk returns true. Another user Jan submits an expense to the same cost object. In this case, Perk returns false.

Submitter with property

Configure a condition node that returns true/false if the submitter contains a specific property. You can check any user property such as name, email, line manager, as well as custom fields.

In this case, this condition returns:

  • True: The cost object associated with the submitter’s expense has a specific property value.
  • False: The cost object associated with the submitter’s expense does not have the specific property value.

For example, if the condition is set up with the Line manager property and matches Alex Smith,

  • If a submitted expense is created by a user whose line manager is “Alex Smith“, it returns true.
  • If a submitted expense is created by a user whose line manager is “Devis Hirt“, it returns false.
Option Accepted values Description
Property String Name (ID) of the field to be checked on the cost centre. For example, it can be any fields present on the cost object, from the cost object name to a custom field.
Matches String / Number / Boolean

Value of the cost object property to be checked.

To add multiple values, click + Add row.

Setting up submitter property validation on a custom field

For example, if you want to check if the user in the custom field Target Administration has value “G000" or "G001":

  1. Identify the custom field created in the user. If this is not already set up, you may need to contact Perk support to do this. Remember the Name value, as you need it in the next step.
    - Name: customInformation.targetAdministration
    - Label: Target administration
    - Type: Text input 
  2. Click the Submitter with property node in the workflow designer and enter this data. Since you want to check multiple values, enter the value “G001” and then click + Add row to add the second value “G002“:

    - Property: customInformation.targetAdministration
    - Matches: G001
    - Matches: G002

    In this case, Perk checks if the submitter has this property. If true, it performs a cost object approval. If false, it moves the document to “In review”.

Cost object with property

Configure a condition node that returns true/false if the cost object contains a specific property. You can check any cost object property such as cost object name, ERP code, custom fields, etc.

In this case, this condition returns:

  • True: The cost object associated with the submitter’s expense has a specific property value.
  • False: The cost object associated with the submitter’s expense does not have the specific property value.

For example, if the condition is set up with the Name property and matches Sales,

  • If a submitted expense is input to the cost object with name “Sales“, it returns true.
  • If a submitted expense is input to the cost object with name “Manufacturing“, it returns false.
Option Accepted values Description
Property String Name (ID) of the field to be checked on the cost centre. For example, it can be any fields present on the cost object, from the cost object name to a custom field.
Matches one of String / Number / Boolean

Value of the cost object property to be checked.

To add multiple values, click + Add row.

Requires independence true / false If you select this checkbox, the cost object approver must not be the same as the submitter. If the cost object approver is the same as the submitter, it returns false.
Require approvers true / false If you select this checkbox, the cost object must have an approver. If the cost object (even if it is a match) does not have an approve, it returns false.

Setting up cost object property validation on a custom field

For example, if you want to check that the cost object submitted on the expense has been flagged as a special cost object (Special cost object checkbox equals true):

  1. Identify custom field in the cost object. If not available, you may need Perk Support to set this up. Remember the Name value, as you need it for the next step:
    - Name: customInformation.specialCostObject
    - Label: Special cost object
    - Type: Checkbox
  2. Click the Cost object with property node in the workflow designer and enter this data:
    - Property: customInformation.specialCostObject
    - Matches: true

Since you want to check whether the checkbox is flagged or not, enter the value “true”. In this case, Perk checks if the submitted cost object on the expense is a special cost object. If true, it skip the cost object approval. If false, it performs the the approval flow.

Paid with company card

Configure a true/false condition to check if an expense has been paid with a company card.

In this case, this condition returns:

  • True: The expense is paid with a company card
  • False: The expense is not paid with a company card.

Caution: This node is used as a card export condition. It MUST always be placed at the end of the workflow to differentiate the export path. It can also be used in other scenarios, such as after a submit action to route expenses to a different flow.

Expense age ≤ max. threshold

This node allows you to check the age of an expense and ensure it doesn’t exceed a maximum threshold. If the expense exceeds the maximum set, then it returns a false.

It is typically used to design workflows where you need to check if an expense date is not older than a certain number of days.

The node performs the following calculations:

  • Checks the Expense date/payment date on the expense.
  • Computes the difference between today’s date and the Expense/payment date on the expense.
  • Compares with the value entered in the node’s configuration (max. age in days).
  • Returns:
    • if the difference > max. age: false
    • if the difference < max. age: true

For example, companies often want to prevent users from submitting expenses that are older than a month or two. With this node, it is possible to define a specific workflow path that if the expense is older, it cannot be submitted.

Option Accepted value Description
Max. age in days Numeric

This fields allows to specify the maximum amount of days after which the expense is considered to not meet the condition.

Only numeric numbers are allowed (e.g. 1, 2, 3, 30, etc.)

Was this article helpful?