> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/data-migrator/templates/template-designer/adding-filters-to-objects.md).

# Adding Filters to Objects

## ![](/files/zKCgJbupFYkxWbGL5HRU) Overview

This guide explains how to add filters to objects in a template to control exactly which records are migrated. Filters let you move only the specific records you need for an object, rather than transferring its entire data set. You can choose between two filter types: Declarative and SOQL.

* **Declarative**: Uses a simple user interface to create filter conditions. You can combine multiple conditions to create more complex filters.
* **SOQL**: Uses an SOQL (Salesforce Object Query Language) WHERE clause to build a complex record filter. SOQL provides greater flexibility and control over which records are included in the data migration.

## Add Filters

{% stepper %}
{% step %}

### Select Template

1. Click **Templates** from the left sidebar menu.
2. Click the template to add object filters to.

   <div align="left"><figure><img src="/files/jGh2w27toacBXJ3qnh8K" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Select Filter Type

For each object, select the type of filter to add: **Declarative** or **SOQL**. Configuring each is explained in the following sections.

1. Click the object to add filters to.

   <div align="left"><figure><img src="/files/Yj8JTbVVeZIYpKz9Onj3" alt="" width="563"><figcaption></figcaption></figure></div>
2. Click the **Filters** tab.

   <div align="left"><figure><img src="/files/vmWOznBtqU6tZv0fKXxl" alt="" width="375"><figcaption></figcaption></figure></div>
3. Select the type of filter to use.
   1. **Declarative**: See the following sections:&#x20;
      1. [#add-single-declarative-filter-condition](#add-single-declarative-filter-condition "mention")
      2. [#add-multiple-declarative-filter-conditions](#add-multiple-declarative-filter-conditions "mention")
   2. **SOQL**: See the following section:
      1. [#add-soql-filter](#add-soql-filter "mention")

{% hint style="info" %}
Only one filter type can be used per object. You cannot mix Declarative conditions and SOQL filters. The saved filter type is the one you used, and anything entered for the other type is removed.
{% endhint %}
{% endstep %}

{% step %}

### Add Single Declarative Filter Condition

A Declarative filter consists of one or more filter conditions. A filter condition checks whether a record meets a specific rule by comparing a field's value against the filter’s value using a logical operation.

{% hint style="info" %}
The filter in this example does the following:

* Filter **Account** records whose **Name** equals **Example Company**.
  {% endhint %}

1. Select **Declarative** for the filter type.
2. Click **Add Filter** to add a new filter condition.

   <div align="left"><figure><img src="/files/sez1LENvosc5RAIfZZn8" alt="" width="375"><figcaption></figcaption></figure></div>
3. Click the **Select field** dropdown menu.
4. (Optional) Enter the field name to search for the field.
5. Select the field to use for the filter condition.

   <div align="left"><figure><img src="/files/hhq8kd4sIG2fkjuQTGe2" alt="" width="375"><figcaption></figcaption></figure></div>
6. Click the **Select option** dropdown menu.
7. Select the logic operation to use for the filter condition.

   <div align="left"><figure><img src="/files/JfBCACCRDn72BHAzYnB8" alt="" width="375"><figcaption></figcaption></figure></div>
8. Enter a filter **Value** in the last textbox of the filter condition. This is the value the filter compares to the record's value.
9. Click **Save** to save the filter.&#x20;

   <div align="left"><figure><img src="/files/jATCdkGVwRlZALkmkytI" alt="" width="375"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Add Multiple Declarative Filter Conditions

Multiple declarative filter conditions can be added to an object. There are two options for combining filter conditions:

<table data-header-hidden><thead><tr><th width="140.3333740234375"></th><th></th></tr></thead><tbody><tr><td><strong>Basic Logic</strong></td><td>All filter conditions are combined with an <strong>AND</strong> operation. Meaning all filter conditions must be met.</td></tr><tr><td><strong>Custom Logic</strong></td><td>With custom logic, you can combine filter conditions by defining your own custom logic using <strong>AND</strong>, <strong>OR</strong>, and <strong>()</strong> operations. Filter conditions are included with their row number. For example <code>2 AND (1 OR 3)</code> means that the filter is true if condition 2 is met, and either condition 1 or condition 3 is met.</td></tr></tbody></table>

{% hint style="info" %}
The filter in this example does the following:

* Filter **Account** records whose **Name** equals **Example Company**.
* Or, filter **Account** records whose **Type** is not a **Temp**
  {% endhint %}

1. Click **Add Filter** to add another filter condition.

   <div align="left"><figure><img src="/files/zb314TaVVbkM2sbDDLtJ" alt="" width="375"><figcaption></figcaption></figure></div>
2. Complete the filter condition by following the instructions in the section above.

   <div align="left"><figure><img src="/files/n6JEPrbEGfX8gRlvVVF6" alt="" width="375"><figcaption></figcaption></figure></div>
3. Repeat this process to add as many filter conditions as needed.
4. Determine how you want the filter conditions combined. See the table above for an explanation of the options. If **Basic Logic** is used, no other action is necessary.

   <div align="left"><figure><img src="/files/0pvhs1x15Nz7J8OeQN2R" alt="" width="375"><figcaption></figcaption></figure></div>

**Use Custom Logic**

1. Click the **Logic Selection** dropdown menu.
2. Select **Custom logic**.

   <div align="left"><figure><img src="/files/iNb297fiKv4ZZKuLnn9m" alt="" width="375"><figcaption></figcaption></figure></div>
3. Enter your custom logic in the textbox to the right of the dropdown menu.

{% hint style="info" %}
Custom logic can use **AND**, **OR**, and **()** operations to combine filter conditions by their row number.
{% endhint %}

4. Click **Save** to save the filter.

   <div align="left"><figure><img src="/files/VUaTMoA8A5xHHAeByTR0" alt="" width="375"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Add SOQL Filter

The SOQL filter type lets you build complex record filters using a SOQL (Salesforce Object Query Language) WHERE clause. SOQL gives you greater flexibility and control over which records are included in the data migration.

{% hint style="info" %}
The filter in this example does the following:

* Filter **Account** records whose **Name** equals **Example Company**.
* Or, filter **Account** records whose **Type** is not a **Temp**
  {% endhint %}

1. Select **SOQL** for the filter type.
2. Enter your SOQL filter statement in the **WHERE** textbox.&#x20;

   <div align="left"><figure><img src="/files/sTx0NoMBEnMs5RZNaKlJ" alt="" width="375"><figcaption></figcaption></figure></div>
3. Click **Validate SOQL** to make sure the filter statement follows valid syntax.&#x20;

   <div align="left"><figure><img src="/files/suHjeURKyqjRDcGcm44O" alt="" width="375"><figcaption></figcaption></figure></div>
4. If the filter statement is valid, you receive a "**SOQL filter is valid**" message.
5. If there is an issue with the filter statement, the message indicates where the issue is. Fix the issue and validate the filter again.
6. Click **Save** to save the filter.&#x20;

   <div align="left"><figure><img src="/files/zQbl6nQ5uygM9HqmIPOj" alt="" width="375"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Save Template

Once you have added filters to as many objects as necessary, save the template.

1. Click **Save template** to save your changes.

   <div align="left"><figure><img src="/files/FDNdu2XU1f88ylM0PlDm" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.flosum.com/data-migrator/templates/template-designer/adding-filters-to-objects.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
