Free cookie consent management tool by TermsFeed

Configure Sync Filters

On This Page

This page describes how to configure sync filters on synced record types. If you're using a legacy record type, you'll need to configure default filters instead.

Note:  Sync filters are not applicable to record types that use a web service as the source. Instead, use the record data source expression to conditionally filter out data.

What are sync filters?

Sync filters determine which rows of data from your source are synced and available in the record type. Sync filters evaluate during every sync and exclude any row that does not meet the filter conditions.

For example, your database table may contain order data from the last 20 years, but you only need order data from the last two years to build your application. With sync filters, you can choose to only sync rows that have dateCreated greater than or equal to two years ago.

Why use sync filters?

Sync filters ensure your record types only contain the most relevant data for your business needs.

Filtering to relevant data provides several benefits:

  • Logical data organization: Filter out unnecessary data to focus your record types on specific business processes (like excluding archived orders older than 10 years from an order management app).
  • Faster syncs: Syncing fewer rows reduces the total time required for full syncs.
  • Efficient query processing: Querying large amounts of data can slow down your site and use more resources. By filtering out unnecessary data, you can optimize resource usage and performance on your site.
  • Scalability: For capability tiers with a synced row limit, use filters to partition a large data source into multiple record types (like "Active Cases" and "Archived Cases") to stay within the allowed row count.

When sync filters are evaluated

Sync filters are evaluated during any full sync, incremental sync, or smart service sync on the record type.

Sync filters that use a relationship

You can filter by source fields or by a relationship. If you filter by a relationship, that sync filter applies only when a full sync occurs on the base record type. Changes to the related record type do not immediately affect the data synced in the base record type.

For example, the Comment record type filters by a relationship to the Open Cases record type so that the Comment record type only syncs comments for open cases. If the Write Records smart service changes an open case to "Closed", the comments for that closed case are only removed when a full sync occurs on the Comment record type.

See the basic mode and expression mode comparison table for additional differences when filtering by a relationship, including filter inheritance, testing, and how filters are combined.

Relative date functions in sync filters

When a sync filter uses a relative date function like today(), the function evaluates to a single static value at the exact time the sync runs. Data does not automatically appear or disappear from the record type as the date changes. The sync filter only re-evaluates the next time a sync occurs.

For example, if you only want to sync cases that are due today(), a case with a due date of tomorrow does not appear in the record type until a sync runs on that day.

If your sync filter relies on relative dates, schedule full or incremental syncs to keep the data current.

Add sync filters

You can add sync filters when you configure the source of a record type, or anytime after configuring the source by navigating to the Sync Options page of the record type.

To add a sync filter, use one of the following modes:

Review the comparison table basic mode and expression mode comparison table to see which option best fits your business requirements.

Compare sync filter modes

The following table compares how each mode handles configuration, filter inheritance, combining filters, and testing:

Scenario Basic mode Expression mode
Configuration Basic mode offers a guided experience to filter by source fields or a relationship. Expression mode allows you to write a!queryFilter() or a!queryLogicalExpression() expressions to filter by source fields.
Inherit filters from related record types If your record type uses a database as the source, you can filter by a relationship using Basic mode. When you filter by a relationship, the record type automatically inherit the sync filters from the related record type. You can also filter by the related record fields from the selected relationship to make your filter more precise.

For example, if the Open Case record type has a sync filter configured to only sync open cases, then the Comment record type can filter by its relationship to Open Cases to only sync comments for open cases.
You cannot filter by a relationship in Expression mode, so you cannot inherit filters from a related record type or filter by related record fields.
Combine filters Basic mode automatically joins multiple filters using an AND operator. In Expression mode, you can combine multiple filters using AND or OR operators with a!queryLogicalExpression().
Testing In Basic mode, you can test to see how many rows of data are synced in the base record type if you filter by source fields only. If you filter by a relationship in Basic mode, you cannot directly test how many rows are synced in the base record type. Instead, you can test how many rows are synced in the related record type, then use that number to estimate rows in the base record type. In Expression mode, you can test the filter to see how many rows of data are synced in the record type. Expression mode always filters by source fields, so testing is always available.

Basic mode

To add a sync filter using Basic mode:

  1. In your record type, go to Sync Options.
  2. Under Sync Filters, click ADD FILTERS.
  3. Leave the default selection Basic.
  4. Click Add Filter > By Source Field to filter by a field from the data source.
    1. Select a source field to filter by. Only source types that can be converted to Appian types appear in the dropdown.
    2. Select the operator to apply to the filter.
    3. Use the context menu next to the field to select how you want to pass the value into the filter. The options in the context menu change based on the data type of the field selected. You can enter a static value or enter an expression.
  5. Click Add Filter > By Relationship to filter by a relationship. You can only filter by one relationship.
    1. Select a many-to-one or one-to-one relationship to inherit any filters applied to the related record type. Relationships to a related record type that already filters by a relationship do not appear in the dropdown.
    2. Click Filter by Related Record Field to filter by a field from the selected relationship.
  6. Select the Ignore Filters with Empty Values checkbox to skip filters that have an empty Value. The Ignore Filters with Empty Values option does not appear if you only filter by a relationship.
  7. Click TEST FILTER to validate your filter conditions.
  8. Click OK.
  9. Click SAVE.

Expression mode

To configure a sync filter using Expression mode:

  1. In your record type, go to Sync Options.
  2. Under Sync Filters, click ADD FILTERS.
  3. Select Expression.
  4. In the expression editor, enter an expression that returns a list of a!queryFilter() or a!queryLogicalExpression().

    Note:  Sync filter expressions do not support the now() or loggedinuser() functions, relationship references, or any object references called from the rule! or cons! domain. If you use other relative date functions like today(), review When sync filters are evaluated to understand how these functions behave at sync time.

  5. Click TEST FILTER to validate your filter conditions.
  6. Click OK.
  7. Click SAVE.

For example, the following sync filter expression only syncs opportunities that have a status of active and an opportunity level of either "Must have" or "Should have". Any data that does not meet these filter conditions is not synced in Appian.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  /*
  (Has a status of "Active" AND has an opportunity level of "Must have" OR "Should have")
  */
  a!queryLogicalExpression(
    operator: "AND",
    logicalExpressions: {
       a!queryLogicalExpression(
        operator: "AND",
        filters: a!queryFilter(
           field: "status",
           operator: "=",
           value: "Active")
      ),
       a!queryLogicalExpression(
         operator: "OR",
         filters: {
          a!queryFilter(field: "opportunityLevel", operator: "=", value: "Must have"),
          a!queryFilter(field: "opportunityLevel", operator: "=", value: "Should have")
         }
       )
    }
  )

Edit sync filters

You can update sync filters at any time to accommodate changing business needs.

To edit sync filters:

  1. In your record type, go to Sync Options.
  2. Under Sync Filters, click EDIT FILTERS.
  3. Make any necessary adjustments in either Basic or Expression mode.
  4. Click OK.
  5. Click SAVE.

Remove sync filters

To remove sync filters:

  1. In your record type, go to Sync Options.
  2. Under Sync Filters, click EDIT FILTERS.
  3. Remove the filters in either Basic or Expression mode:
    • Basic mode: Click next to the filters you want to remove.
    • Expression mode: Delete individual a!queryFilter() functions, or delete all functions in the expression box.
  4. Click OK.
  5. Click SAVE.

Feedback