4. Create a Rule
Processes in Atfinity are guided by rules. A rule tells the application what actions it should take, when a specific condition is met.
In our scenario, whenever someone selects to open a contract for an individual account, it is a given that we must have a person on the contract who is the account holder. We therefore can make a rule that ensures that there will be at least one person who's account holder.

Step 1: Create a Rule

All we need to do for this step is to give the rule a key. As always, we should choose something unique and yet descriptive. In our case, 'ensure_one_person_ah' serves that purpose well.

Step 2: Write a Rule Condition

Every rule has a condition which defines when the rule will be triggered.
We want a rule to take action once someone has selected the account type to be an individual account. We therefore write the condition:
c is Contract
c.account_type = individual
In the first line we have defined the ontology reference c which we can use in the expression in the second line which checks whether the information 'Account type' has the value 'individual'. If it does, the condition evaluates to true and the rule will come to live.

Step 3: Add an Action to the Rule

An Action defines what should happen if the rule's condition evaluates to true. We want the action to ensure an instance, namely a person who's account holder. Therefore, we write:
ensure 1 Person, AccountHolder
Atfinity will now automatically create a Person with the role of an account holder once individual account is selected as an account type.
As an exercise, try to create another rule, which 1) checks if a client is younger than 18 years old and if so 2) creates a warning if so. Think about which information you need for the rule's condition and which ontology this information belongs to. Also, click here for another hint.
In the next article, we Create a Process, which will be the last thing we have to create.