# How to work with Related Objects

Related objects are objects referred to the current one via their lookup fields (or another similar way). Because of many records belong to related objects can be linked to the same record of current object, we should use only one of them. We need to specify:

* related object itself
* conditions that should restrict related object records
* sorting order

The top first record from the related object that match condition will be used as a Data Source.

### Configure Related Object as column Data Source

Go to  ["Data Source Configuration"](https://docs.flexikanban.ai/standard-kanban/how-to-configure-column-data-source#sobject-data-source). Select "Related Objects" tab:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FOiPHWCizWgvnJadB1V7E%2Ffile.excalidraw.svg?alt=media&#x26;token=9f7b0819-554a-4b77-9bcf-7494871f55f1" alt="" class="gitbook-drawing">

Select related object, to configure condition for current related object click "Add Condition". Row with new condition form will be shown. Click button to choose field. Select "Operator", "Type" and "Value" for condition.

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2Fpsbx5CQgjGZY6LgJ9Oqw%2Ffile.excalidraw.svg?alt=media&#x26;token=fddef8a6-6a47-4839-858f-63acddcc60bf" alt="" class="gitbook-drawing">

To configure sorting order for current related object click "Add Order". Row with new order form will be shown. Click button to select Field for sorting. Select order type and specify nulls logic (how fields without data will be sorted - shown last or first).

### Configure card elements to use related object

Fields from related object can be set in kanban cards using merge fields.

Go to Compact Layout editor, add necessary element and use related object fields on it:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FN4UBQkgl1qURav9WznGm%2Ffile.excalidraw.svg?alt=media&#x26;token=0824add8-3af4-41ae-af75-62b18a74c553" alt="" class="gitbook-drawing">

Related object fields are available in the formula builder. Proper notification will remind user configure related object on columns:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FTO0ZyNBg0WGxJuw9YYxX%2Ffile.excalidraw.svg?alt=media&#x26;token=666ff2ff-a1a7-4b3b-afb4-29007af5883d" alt="" class="gitbook-drawing">
