Explore scenarios to gain insights into how to customize the conditions for approval policies with practical situations, and adapt them to fit the distinctive needs and goals of your organization.

Overview

On this page, we delve into a variety of real-world scenarios of conditions for triggering approval policies. These scenarios are designed to help you understand how approval policies can be automatically set to specific invoices and how to customize these conditions to address specific operational, compliance, and governance needs within your organization.

  • The conditions mentioned on this page are designed using the MoniteScript and must be inserted into the trigger field. Check the Evaluated string section for further information about the syntax.
  • The event_name field is mandatory.
  • The if, then, and else statements are not allowed into the trigger field.

By invoice amount

Set an approval policy for all invoices worth more than 300 EUR:

1{
2 "name": "By invoice amount",
3 "description": "Invoices worth more than 300 EUR",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 "{invoice.currency == 'EUR'}",
8 "{invoice.amount > 30000}"
9 ]
10 },
11 "script": []
12}

If you receive invoices in multiple currencies, you can convert the amount to some base currency to use the same threshold for all invoices:

1{
2 "name": "By invoice amount",
3 "description": "Invoices worth more than 300 EUR (after currency conversion)",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 {
8 "left_operand": {
9 "call": "Currency.convert",
10 "params": {
11 "amount": "{invoice.amount}",
12 "from_currency": "{invoice.currency}",
13 "to_currency": "EUR"
14 }
15 },
16 "operator": ">",
17 "right_operand": 30000
18 }
19 ]
20 },
21 "script": []
22}

With specific currencies

Set an approval policy for all invoices with specific currencies, in this case, EUR and USD:

1{
2 "name": "With specific currencies",
3 "description": "Invoices with specific currencies",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 "{invoice.currency in ['EUR', 'USD']}"
8 ]
9 },
10 "script": []
11}

With specific tags

Set an approval policy for all invoices containing one of the specific tags:

1{
2 "name": "With specific tags",
3 "description": "Invoices containing one of the specific tags",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 {
8 "any": [
9 "{'Marketing' in invoice.tags.name}",
10 "{'Urgent' in invoice.tags.name}",
11 "{'d566f374-463a-4a07-b252-2eb0200d62ce' in invoice.tags.id}",
12 "{'398b2748-b255-46da-b8dc-a01219539ec9' in invoice.tags.id}"
13 ]
14 }
15 ]
16 },
17 "script": []
18}

From a specific project

Set an approval policy for all invoices related to specific projects:

1{
2 "name": "From specific project",
3 "description": "Invoices related to a specific project",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 "{invoice.project_id == 'd566f374-463a-4a07-b252-2eb0200d62ce'}"
8 ]
9 },
10 "script": []
11}

For specific counterparts

Set an approval policy for all invoices from a specific list of counterparts:

1{
2 "name": "For specific counterparts",
3 "description": "Invoices from a specific list of counterparts",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 "{invoice.counterpart_id in ['398b2748-b255-46da-b8dc-a01219539ec8', '4d0ff737-070b-427a-980c-c8ee7961577d']}"
8 ]
9 },
10 "script": []
11}

For specific users

Set an approval policy for all invoices from a specific list of users:

1{
2 "name": "For specific users",
3 "description": "Invoices from a specific list of users",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 "{invoice.was_created_by_user_id in ['d566f374-463a-4a07-b252-2eb0200d62ce', '398b2748-b255-46da-b8dc-a01219539ec9']}"
8 ]
9 },
10 "script": []
11}

By amount, currency, tags, AND specific counterpart

Set an approval policy for all invoices worth more than 1000 EUR, from a specific counterpart AND with specific tags:

1{
2 "name": "By amount, currency, tag, AND specific counterpart",
3 "description": "Invoices worth more than 1000 EUR, from a specific counterpart AND with specific tags",
4 "trigger": {
5 "all": [
6 "{event_name == 'submitted_for_approval'}",
7 "{invoice.amount > 100000}",
8 "{invoice.currency == 'EUR'}",
9 "{invoice.counterpart_id == '398b2748-b255-46da-b8dc-a01219539ec8'}",
10 "{'d566f374-463a-4a07-b252-2eb0200d62ce' in invoice.tags.id}",
11 "{'398b2748-b255-46da-b8dc-a01219539ec9' in invoice.tags.id}"
12 ]
13 },
14 "script": []
15}

By counterpart, plus amount OR specific tag

Set an approval policy for all invoices from a specific counterpart worth more than $300 OR with a specific tag:

1{
2 "trigger": {
3 "all": [
4 "{event_name == 'submitted_for_approval'}",
5 "{invoice.counterpart_id == '398b2748-b255-46da-b8dc-a01219539ec8'}",
6 {
7 "any": [
8 "{invoice.amount > 30000}",
9 "{'d566f374-463a-4a07-b252-2eb0200d62ce' in invoice.tags.id}"
10 ]
11 }
12 ]
13 },
14 "script": []
15}