# Customizing Names of Cases and Instances

When a new case is started in Atfinity it will be automatically given a generic name, e.g. 'Contractual Relationship 729'. The same happens when a new instance is created. To customize the name that is given so it contains more specific information from the case or instance a formula can be used. The formula is an expression in Atfinity's Rule Language (RuLa) that uses known values of information from a case or instance and builds a name from it. So an instance of a person would be called 'Simon Fisher' instead of 'Person 289'.

### Writing Name Formulas for Cases

Defining a name formula in a process means that all cases which are started with this process will be named according to that formula. The formula can both access information of the outcome instance of a case directly with the reference `OUTCOME_INSTANCE` as well as information of other instances linked to the outcome instance, latter which is described in the second example below.

In the first example the name of a case should just be the contract number. This is information of the outcome instance, which is why OUTCOME\_INSTANCE needs to be used as well as the information key contract\_number:

```
JOIN(
    [
    "Contract Nr: ",
    OUTCOME_INSTANCE.contract_number,
    ]," - "
)
```

This will return a String like 'Contract Nr: 11896'.

Naturally, combinations of RuLa functions can and sometimes need to be used in the name formula to create more complex names.

To access case information from instances other than the outcome instance the `get_properties_from_instances` function needs to be used. For example, if the case name should include all the names of all the account holders on a contract the following expression is used.

```
JOIN(
    get_properties_from_instances(
        instances(
            AccountHolder
        ), 
        full_name
    ),
    " ; "
)
```

This expression does three things:

* `instances(AccountHolder)` returns a list of all the instances in a case that take the role of an account holder,
* `get_properties_from_instances` then gets all the full names of all these instances
* and `JOIN` returns one string combining all the names separated with a semicolon.

### Writing Name Formulas for Instances

Instances of ontologies can also be given a customized name by defining a name formula. Here, only information of the respective instance can be used. Therefore the reference `self` is used, which makes the instance point to itself.

It makes sense that an instance of a person has the name of the person. Therefore, an information like full\_name can be used in an expression as follows:

```
self.full_name
```

Of course, it is possible to use other RuLa functions in the name formula to connect multiple pieces of information into one string and format it as required:

```
JOIN(
    [self.account_name, self.client_number], 
    ", "
)
```

This function returns a string of the account name and the client number separated by a comma.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.atfinity.io/guides/advanced-topics/customizing-names-of-cases-and-instances.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
