How to write Conditions


By attaching conditions to documents, document sections and proofs, you configure them in such a way that Atfinity will ask what needs to be asked, while omitting what can be left out, to guarantee efficiency.
Here you will learn how to write conditions.


The conditions you set on documents and proofs use boolean logic. If a condition evaluates to 'true', the document or request for proof it relates to will be included in the case, where its fields need to be filled out.
A condition for documents and proofs consists of:
  1. 1.
  2. 2.
The declaration defines whom the condition is relevant to. It consists of a reference variable, the operator is and an ontology, e.g. p is Person. From this point on you can use the reference p in the condition to refer to an instance of the ontology Person.
The expression implements the logic using information in a case.
A US citizen wants to open an account at a German bank. The bank's rules state US citizens have to fill out a W9 form to complete the onboarding process.
To make sure this happens, while configuring Atfinity, attach this condition to the W9:
ah is AccountHolder, Person
ah.us_person = true
The declaration on line 1 makes the W9 form relevant to account holders who are persons. So the form will not necessarily appear when a US company asks the German bank to open an account.
The expression on line 2 makes sure the W9 form will show up in the system when the condition that the account holder is a 'us_person' is true.

Document Sections

Attach conditions to certain sections of a document, so these sections do not clutter a document when they are not relevant to the case.
Since the declaration has already been done in the document condition, a document section condition only consists of:
  1. 1.
The expression follows boolean logic: if what it describes is true, the section is included in the document. If it is false, the section is omitted. You can only use variables that have previously been declared in the document condition.
p is Person
p.is_employed = true
This expression is added to the Document Section 'Employer Information'. It ensures the section will only be included when the person this document is about is employed.


Writing the condition for proofs follows the same path as conditions for Documents.
A Swiss bank requires clients who live in Switzerland, but do not have the Swiss nationality, to provide a residency permit as proof they are living in the country legally.
The condition that guarantees this request for proof of legal residency shows up when required, is:
ah is AccountHolder, Person
ah.nationalities not contains 'ch'
ah.domicile = 'ch'
Line 1 holds the declaration, that this request for proof applies to account holders who are persons.
The expression on line 2 makes the request for proof apply only if the accountholder's nationality is not given as 'ch', the country code for Switzerland.
Finally, on line 4 the expression sets the final condition: only if the account holder (who is a person, not of Swiss nationality) has their domicile in 'ch', will the application request for the proof to which these conditions were attached - in this case, a valid residence permit.
The use of the operator and on line 3 means that both elements in the condition have to be 'true', in order for the proof to be requested in the case.


Writing the condition for rules follows the same path as conditions for Documents.
In the case that an account should be opened where the account holder is not of age, a rule should ensure that the role of a parent guardian becomes a requirement.
The condition that evaluates to true in case the account holder is a minor, is:
ah is Person, AccountHolder
ah.type_of_person = natural_person
and then
YEARS_AGO(ah.date_of_birth) < 18
Line 1 holds the declaration that this rule applies to account holders who are persons.
The expression on line 2 makes the rule only be executed if the account holder is a natural person.
The expression on line 4 checks whether the account holder’s age is younger than 18 years.
Finally, the operator and then on line 3 connects the two expressions. Both have to evaluate to true in order for the rule to be executed, similarly to the operator and. However, with and then the second expression is not evaluated if the first expression has already been evaluated to false.