Complex filtering in data deployments

How to use complex filters to set which records get deployed

Tom Smith avatar
Written by Tom Smith
Updated over a week ago

Sometimes you might want to use complex filters for your data deployments. For example, you might want to deploy Accounts updated in the past week that have an Account Owner in a particular department.

You can create this filter using Salesforce's formula fields and Gearset's data deployment filters.

Set up the formula field in Salesforce

We'll start by creating a new field on the Account object in Salesforce.

The field type needs to be Formula.

We'll name the field Recent accounts for textiles department and set the return type to Checkbox.

We need to create the formula, which will return true for records we want to include in the deployment and false for records we don't want to include.

In this case, the formula is:

Owner.Department = 'Textiles' && LastActivityDate > DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) - 7)

This means that the Account owner's department must be Textiles and the last activity date on the Account must be within the past week.

Once you're happy with the formula, save the field, adding it to any layouts needed.

Filter on the formula field in Gearset

We'll use the new field as a filter in Gearset.

Start a new data deployment, and add a filter to the Account object.

We'll filter on the Recent accounts for textiles department, setting the value to true.

We can check the filter before deploying the records.

The deployment will only include Accounts that match our formula.

We hope this helps you deploy the data records you need! If you need more clarification on the process, please get in touch with us.

Did this answer your question?