Condition and Condition branch masking activities are used in tandem to provide better control over what records are masked and in what way.

Records often have to be masked in different ways depending on other information (e.g. generating a first name based on a gender or country), and these masking activities provide that option.

Table of contents


Condition and condition branch activities are used in situations when the way a record is masked depends on other a certain factor or piece of data. The Condition masking activity acts as an encompassing element that contains a variable number of condition branches that define conditions under which specific masking algorithms are to be performed. Each condition branch represents a condition and the corresponding masking logic that is performed if this condition is met. Branches are checked one by one for each record, and if a condition of one is met, then the masking logic of that branch is performed while other branches are ignored.

If no conditions are met, the masking logic set under the Default branch is executed. This branch has no condition and it cannot be set, but its masking logic can be changed. The masking logic of the default condition branch can be left empty, in which case, if no other conditions are met, all condition branches will be ignored.

Conditions can make use of currently processing records since they are most often the main factor in determining a way to mask a record. To create a condition that checks a certain value of a record, use the following syntax:
x => x.RecordValue == true

While this example only checks if a certain value is true or not through a simple lambda expression, you can create conditions that check whether a value is equal to a specific value, if it is greater or smaller than a specific value or date, etc. Creating custom code for more complex conditions is recommended to keep your package more readable.


In this example we want to mask first names of customers from the database. The Customer table also has information about the gender of the customer, so we can use it to replace first names in the database with ones of a certain gender. To do this, we select the Condition masking activity from the Toolbox and place it in our Customer masking activity. We then place two Condition branches inside the condition masking activity.

Possible values of the Gender column in the database are M and F. The condition that checks for male customers will then look like this:
record => record.Gender == "M"

Beneath these conditions we place Pick first name from list masking activities, select the FirstName property (the property we want to mask) and set that we want to replace it with a first name of that specific gender from our picklists. In case of records that do not have a set gender in the database (or the value is different from what we're expecting), we also define logic in the default branch which will pick a replacement first name, regardless of gender, so every record is masked.

Conditional first name masking Figure 1: Conditional first name masking

Note: A more advanced example of using the Condition and Condition branch activities is creating the masking that is conditioned by data from related entities.


Activity Property group Property name Description Example
Condition Misc DisplayName Display name of the activity in the workflow. Condition
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -
Condition branch Input properties Condition Condition used inside condition branch. record => record.FirstName == "Julia"
Misc DisplayName Display name of the activity in the workflow. Condition branch
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -