This page describes the difference between source filters and default filters, and how to apply each to your record type.
After defining the source of your record type, you may decide that you don't need all the data from your source, or that you want to exclude certain data to prevent end users from viewing it. Appian Records allow you to create filters on your source data so you can exclude data that does not meet the specified criteria.
When your record type has data sync enabled, you can apply source filters to specify which source data is synced and available in the Appian system. With source filters, you can exclude unnecessary data so that you are only working with relevant data in your application.
For example, in an Employee record type with sync enabled, you may only need information about current employees. To exclude unnecessary data about inactive employees, you could apply a source filter so that only source data that has isActive = true
is available in Appian. Using source filters, you can simplify your data model to only include the data you need, and use data from larger datasets that would otherwise exceed the row limit for record types with sync enabled.
In addition to source filters, you can also apply default filters to record types (synced or not) to make data in the Appian system conditionally available to end users. With default filters, you can choose when and who can view certain data. For example, back in the Employee record type, you may only want managers or executives to have access to each employee's quarterly review score. Using a default filter, you can make the quarterly review score conditionally available to users in the Managers or Executives groups.
Both default filters and source filters are not applicable for record types that use a web service as their data source. Instead, you can use the expression rule for the record data source to conditionally filter out records.
When you enable data sync on a record type that uses a database table or Salesforce object as the source, you can add source filters. Source filters allow you to determine which rows of data from the source are synced in Appian based on the conditions you specify. When a source filter is applied, only the data that meets the specified criteria will be available in the Appian system and visible to end users.
For example, if you have a Customer Case database table that contains 3 million rows of data and includes all active and closed cases, you may only need to see active cases in your record type. Using a source filter, you can choose to only sync rows from the database that have Case Status = Active
. This allows you to only work with relevant data, which can improve query performance, and use a larger data source in your record type without exceeding the row limit for record types with sync enabled.
You can add source filters when you enable sync and configure the source of a record type, or anytime after configuring the source by navigating to the Data Model page of the record type. The sections below explain how to add source filters after the source of the record type has been configured. To learn how to add source filters when configuring the source of a record type with sync enabled, see Choose a Record Type Data Source.
To create a source filter, use one of the following options:
AND
union.a!queryLogicalExpression()
.Basic mode allows you to easily set up filters using three criteria: Field, Condition, and Value. Multiple filters are combined using the AND
operator.
To add a source filter using Basic mode:
Expression mode allows you to create more complex filters. You can switch to Expression mode at any time during your filter configuration. For example, if you want to use OR
to combine filters instead of AND
, simply create all of your filters in Basic mode, then switch to Expression mode and change AND
to OR
for the a!queryLogicalExpression()
operator parameter.
When configuring source filters in Expression mode, you must use an expression containing a list of a!queryFilter()
or a!queryLogicalExpression()
.
To configure a source filter using Expression mode:
In the expression editor, enter an expression that returns a list of queryFilter
or queryLogicalExpression
.
Source filters do not support the now()
or loggedinuser()
function, nor any object references called from the rule!
or cons!
domain.
For example, the following source filter expression would only sync 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 will not be 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")
}
)
}
)
For more information on specifying filters as an expression, see a!queryFilter() or a!queryLogicalExpression().
Default filters allow you specify which records appear in the record list and views based on the conditions you specify.
When a record is filtered out by a default filter:
Each default filter defines a condition that must be true for a record to display in the list. If you have multiple conditions, the record must meet all conditions in order to display.
For example, in a Customer Case record type, you may want case managers to view all customer support cases, but you only want support engineers to see the cases that are assigned to them. Using a default filter, you could create a condition that states if a logged in user is a member of the Support Engineers group, only return cases assigned to the logged in user; Otherwise, return all customer support cases.
You can create default filters for record types with or without sync enabled. However, if you are using a record type with sync enabled, it's recommended that you use source filters instead of default filters. Like default filters, source filters can exclude data from end users; however, source filters can also exclude unnecessary data from the Appian system entirely, which can improve query performance.
To create a default filter, use one of the following options:
AND
union.a!queryFilter()
or a!queryLogicalExpression()
.Creating filters by field allows you to easily set up filters using three criteria: Field, Operator, and Value. Multiple filters are combined using the AND
operator.
To create a default filter by field:
rv!
prefix.Enter the value for the comparison in the Value field. This is an expression field, so encase text values in quotes.
For example, the filter in the following screenshot removes all records with a status of Closed.
Creating filters using an expression allows you to create more complex filters. When configuring source filters in Expression mode, you must use an expression containing a list of a!queryFilter()
or a!queryLogicalExpression()
.
To create a default filter using an expression:
In the DEFAULT FILTERS section, select Expression.
queryFilter
or queryLogicalExpression
.For example, the following default filter expression returns cases that are either assigned to the logged in user, or cases that are not assigned to the "Global Users" group but are either Urgent or High priority:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
(Assigned to User OR (NOT Assigned to "Global Users" AND (priority="Urgent" OR priority="High")))
*/
if(a!isUserMemberOfGroup(loggedInUser(),cons!CASE_GROUP_GLOBAL_VIEWERS),
{},
a!queryLogicalExpression(
operator: "OR",
logicalExpressions: {
a!queryLogicalExpression(
operator: "AND",
filters: a!queryFilter(
field: "userName",
operator: "=",
value: loggedInUser())
),
a!queryLogicalExpression(
operator: "AND",
logicalExpressions: {
a!queryLogicalExpression(
operator: "AND",
filters: a!queryFilter(
field: "userName",
operator: "<>",
value: cons!CASE_ADMIN_DB_KEY_1)
),
a!queryLogicalExpression(
operator: "OR",
filters: {
a!queryFilter(field: "priority", operator: "=", value: "Urgent"),
a!queryFilter(field: "priority", operator: "=", value: "High")
}
)
}
)
}
)
)
For more information on specifying filters as an expression, see a!queryFilter() or a!queryLogicalExpression().