How to write Rules
Rules guide the processes of Atfinity. They consist of:
  • a condition, describing one or several requirements.
  • one or more actions, telling Atfinity what should be done if the rule's condition evaluates to true.
In this chapter you learn how to create and configure rules.

The Basics

To create a new rule go to ‘Rules’ in the configuration menu and click on ‘Add Rule’.
In the screen that pops up, give the new rule a key. It must be written in snake_case: no capital letters and no spaces. Instead use “_” to separate words if you use more than one word. Example: send_email_to_client, assign_value_xy. It's most effective to choose a key that describes what the point of the rule is.
After clicking 'Confirm' the rule will show up at the top of the Rules overview screen. Click on it to open its configuration.
Here you can write a condition and add one or more actions to it. More about that is described further below.
In the ‘General’ tab of the window you have the following additional options:
Option
Description
Color Tag
You can select a color tag which the rule will be marked with on the Rule overview screen.
Condition
If the condition written in here evaluates to true, the actions added in this rule will be executed.
Create missing values
If a condition mentions an unknown value of an information, the information will be asked in the Case Manager and a value needs to be provided.

Writing a Condition

Conditions are made up of declarations and expressions. They are written in RuLa.
In a declaration, you introduce a variable to the rule. Only then can you use the variable elsewhere in the rule.
In an expression, you bring an ontology and a piece of information together. By adding an operator and a value, you describe a requirement. Atfinity will check if this requirement is met in the case. If so, the condition evaluates to true and the action(s) attached to it will be executed.
Example of a condition for a rule:
p is Person
p.nationalities = uk
and
p.domicile = eu
Line 1 is the declaration, introducing variable p to the rule.
Line 2 attaches the information nationality to the ontology Person, then describes this p 's nationality should be 'United Kingdom' for the condition to be partially true. Partially, because the operator and indicates the expression on line 4 also has to be true for the whole condition to evaluate to true.
This condition triggers actions only when a client in a case has UK nationality, and lives in an EU member state.
Add one or more actions, so Atfinity knows what you want it to do when the condition evaluates to true.

Writing Actions

You can add as many actions as you need to a single rule. They will all be executed if the condition at the top of the rule evaluates to true.
To add an action to a rule, click on the 'Add new action' button, right below the field that holds the name and condition for your rule. From the drop-down menu, choose which action you want to add.
For each type of action, the next steps are described below.

Create Issue

Add this action, if there is a condition under which you want to alert the user of the Case Manager to an issue that has to be taken care of, before the case can proceed. You can write a description which will appear with the issue. See also Action: Create Issue.
In the example below, the issue is raised when the account selected is not a joint account, but we're dealing with more than one account holder. The issue will disappear either once the number of account holders goes down to only one account holder or if the account type is changed to a joint account. Then the Rule's condition is no longer true and the action will not be executed anymore.
This is how the issue will appear in the Case Manager:

Create Warning

Add this action, if you want to warn the user of the case manager about something. The case can proceed, whether the user acts on the warning or not. See also Action: Create Warning.
In the example below, a warning is issued when dealing with a politically exposed person (PEP). Therefore this contract needs management approval.
In the Case Manager, the warning will appear like this:

Create Comment

Add this action, if you want to add a comment to a case if the requirement(s) described in the Rule's condition is/are met. Comments, once they appear in a case, can evolve to complete conversations about the case between users involved with it, directly within the case. Comments can also be assigned to a user, making them a replacement for tasks. See also Action: Create Comment.
In the example below, a user will get an extra nudge in the form of a comment, to review and approve a case.
This is how the comment will appear in the Case Manager:
The user of the case manager can click 'Resolve' to dismiss the comment, 'Reply' if the comment comes from another user, or 'Assign' to make it the task of a specific user to handle what is said in the comment.

Ensure Instances

With this action, atfinity checks whether the instances you specify are present in the case. If they are not, the platform will create them - again: only when the rule's condition is met. See also Action: Ensure Instance.
In the following example, the action will be triggered when we're dealing with a contract that involves a joint account. The action causes Atfinity to check if there are already two instances 'Person' with the role 'AccountHolder' present in the case.
Important to notice is that the number of instances to be created (in our example '2') is considered as a minimum. That means...
  • ...if there are none, Atfinity, will create two new instances.
  • ...if there is only one, Atfinity will create another one, so in the end there will be two.
  • ...if there is already two, Atfinity does not change anything.
  • ...if there is more than two, Atfinity does not change anything either, meaning the rule will not delete any instances if there are more than the minimum.

Require Roles

This action makes sure that a role becomes available in a case, if the condition you have entered is met. Selecting this action requires you to select the roles that should become available. They can be chosen from all roles captured in Atfinity. See also Action: Require Roles.
Selected roles will be displayed in a case, and available for users to assign them to instances. However, they are not automatically assigned. For automatic assignment, use Ensure Instances or Assign Values instead.
In the example below, the action is used to ensure that the role of an email holder becomes required when it has been selected that communication between the bank and the client should happen via email. The role will then be visible in the party matrix.

Assign Values

Use this action to provide a value for an information field. This is convenient if an information field logically speaking has a fixed value in a given situation - for example, making the US Dollar the reference currency for every case where the account holder lives in the US. See also Action: Assign Values.
The action 'Assign Values' only assigns values which the user has not provided yet. In other words, Atfiniy will never overwrite a value that has already been provided by the user.
A user is always able to change an assigned value. This is the default setting. In case the user should not be able to change an assigned value, the information can be set to 'read-only'.
In the example below, this action is used to set the reference currency to Swiss francs (CHF) once an instance of the ontology ‘ContractualRelationship’ is being created.

Writing Actions: API Send Email, World Check, and IDnow

The API Actions listed below enable you to send data from atfinity to external servers, and receive the reply within atfinity.
Currently, you can define actions that will automatically send out emails, perform background checks, verify identifications, and enable digital signatures, as always only as long as the condition you attach to the action(s) evaluates as true.

[API] Send Email

This action sends out an email, using the configured SMTP service. The content of the message is determined either by providing the subject line and text body in the action, or by a template. When using a template, also indicate the language in which it should be sent. Read here how to create such an email template.
The field 'About' at the top of this action indicates which values are required as input assignments for the action to work, and in what format you should provide them.
The output assignment is an API_RESULT object, which will contain a boolean (true/false), indicating if the mail has been sent successfully.
All values have to refer specifically to the instance featured in the rule's condition.
Below is an example of a rule condition, which evaluates to true when we're dealing with a client with UK nationality, who lives in the EU.
Let's say we decide to always inform UK clients living in the EU about changes we need to make to their contracts, due to some external developments. One way to do that, is through this API action:
Alternatively, when using an email template, the action would look as follows:

[API] World-Check

Triggering the World-Check action will send data on a person from atfinity to the World-Check database. The response helps to identify people with a heightened risk, by telling you whether the person has hits in the World-Check database, how many hits were found, and when the check was performed.
As input assignments for this action, provide up to six data points on an individual. All input assignments are listed in the 'About' field of this action.
All values have to refer specifically to the instance featured in the rule's condition.
The response from the World-Check is an API_RESULT object.
Here's what a World-Check action could look like:
This action creates a new IDnow link, and sends it via email to the specified address. To make this work, define which values should be sent to the IDnow server under 'Input Assignments'. The 'About' field of this action shows you which values you can use, and which of those are required.
For the input assignments dealing with the email part of this action, provide either the subject line and body as text, or point to an email template. When using a template, also indicate which language it should be sent in.
Read here how to create email templates.
All values have to refer specifically to the instance featured in the rule's condition.
As output assignments, the API_RESULT object will contain crucial data on the ID of the instance in the case.
Below is an example of how this action could be configured, when the rule's condition features p is Person.

Adding a Rule to a Process

Once you have created and configured your rule, make sure that you have added it to a process. Otherwise the rule just sits idle and will never be executed.
Go to the process overview screen and open the process you would like the rule to have an effect on. Under the 'Rules' tab, look for your newly created Rule and add it to the Process by click the check mark. For more information, see here.