---
schema_version: "1"
id: 47a75c33cd24c4ea1c5aa6d29bc7fdc6612896511a68d8e5b8c2699eaa1405a3
title: Use Custom Values in Anonymization Templates
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/anonymize_o_use_custom_replacement.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.anonymize_o_use_custom_replacement.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: fc2a53b9e3ad95676bdbf156b2ca0aa1b691e5f5bb1b6985d93f9c8d668dfd87
description: Define custom anonymization patterns when masking data to replace sensitive information with realistic, yet fictitious, data. Create custom patterns across multiple fields for data such as email addresses, phone numbers, or social insurance numbers.
products:
  - Security
  - Salesforce Platform
release: "264"
---
# Use Custom Values in Anonymization Templates

Define custom anonymization patterns when masking data to replace sensitive information with realistic, yet fictitious, data. Create custom patterns across multiple fields for data such as email addresses, phone numbers, or social insurance numbers.

## Define a Custom Anonymization Pattern

1. In the anonymize template that you want to work with, click Edit.
    
    The anonymize template re-displays in Edit mode.
2. Select an object.
3. For the object's field that you want to anonymize, from its Replace with drop-down menu, select Custom.… You can [create the same custom pattern across multiple fields](https://help.salesforce.com/s/articleView?id=platform.anonymize_o_use_custom_replacement.htm&release=264.0.0&type=5).
    
    The Custom Replacement Value dialog opens.
4. Click the plus icon to select the block you need. Each option is a building block that can be used on its own, in combination with other blocks, or used multiple times. See [Custom Block Options](https://help.salesforce.com/s/articleView?id=platform.anonymize_o_custom_replacement.htm&release=264.0.0&type=5).
5. Click Set Value.
    
    the pencil icon appears next to the field the custom pattern is applied to.
6. If you used multiple selection, click Apply.
7. Click Save.
    
    The pencil icon, changes to the look icon. You can check the custom pattern again before anonymizing the values.

## Create Custom Anonymization Patterns Across Multiple Fields

If required, you can select multiple fields of the same type, and change their value to have the same pattern across all fields. Any pattern already defined for these fields is overridden.

1. Select the checkbox to the left of the row of the fields.
    
    When you select more than one field, a dialog box appears showing the number of fields selected, field type and the replacement options.
2. From the Replace with drop-down list, select Custom...
3. Click the add icon to select the building block you need to begin building your custom anonymization pattern.
4. Continue with Step 4 in[Define a Custom Anonymization Pattern](https://help.salesforce.com/s/articleView?id=platform.anonymize_o_use_custom_replacement.htm&release=264.0.0&type=5).

- After multiple selection is applied, if the generated pattern for a single field is longer than the maximum number of characters allowed, the value is truncated accordingly for that field. Note that the character value for the individual field shows as exceeding, as it also holds the value for the other fields selected.
- For example, if you select two fields and create a custom pattern with 80 characters, but one field has a maximum character value of 10 and one of 90, when you open each field Custom Pattern separately, all 80 characters display, but one field's character counter shows as 90/10 and the other field's character counter shows as 80/90.

## Example: Anonymize an Email Address

If you wish create an email address with a fixed domain and a list of top-domain name options to be randomly selected.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-own_from_salesforce-264-0-0-production-enus/8ac98673-ede2-4046-a41e-2d5c846f24ff/images/icon_note.png)

Note Ensure the patterns are valid, the application does not validate the generated result for email address and/or URL formats.

1. Click the plus icon to start building.
2. Select the Library block, and from the drop-down, select Name.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-own_from_salesforce-264-0-0-production-enus/8ac98673-ede2-4046-a41e-2d5c846f24ff/images/icon_note.png)
    
    Note To create a valid email address, any library values selected for an email field type are generated in English.
3. Click the plus icon.
4. Select the Free Text block.
5. Enter the domain you wish to use. For example "@SANDBOX".
6. Click the plus icon.
7. Select the List block.
8. Enter the values of the top-domain name options, and click the Tab key and/or paste values separately by a comma to form the list..
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-own_from_salesforce-264-0-0-production-enus/8ac98673-ede2-4046-a41e-2d5c846f24ff/images/icon_note.png)
    
    Note To create a valid email address, spaces are automatically removed from the generated value.
9. Click Set Value.
    
    The pencil icon appears next to the field the custom pattern is applied to.
10. If you used multiple selection, click Apply.
11. Click Save.
    
    The pencil icon changes to the look icon. You can check the custom pattern again before anonymizing the values.

## Example: Anonymize a Phone Number

To create phone number values having the prefix 1-800-nnn-nnnn, define the custom pattern.

1. To generate a custom replacement value that appends the suffix .invalid to email addresses, define a custom pattern for the example field PersonEmail, using the building block Existing Value followed by the building block Free Text.
2. To add a PREFIX title before the user name, define the custom pattern using the following building blocks:
    1. Library and from its drop-down menu, select the Replace with option Full name.
    2. List - its Predefined list dialog must contain prefix titles, for example, Mr., Ms., Mrs., Dr., Prof., Hon., Rev.
3. Set FIXED TEXT for all records of a specific field, for example, to have all records of a specific field display the text “One value for all”, define the custom pattern using the Free Text building block.
4. To generate a SIN (Social Insurance Number) of the format nnn-nnn-nnn, create the following pattern using three Number Range building blocks, corresponding to each number group (nnn), and two Free Text building blocks that provide the SIN format's required dashes ( - ), placing one after the first number group and placing the other after the second number group.
5. To generate a DATE within a specific time period, using the date format YYYY-MM-DD. For example, a date that occurs during the first quarter (Q1) of the year 2022, define the custom pattern using the following building blocks:
    1. Free Text defined with the entry 2022-
    2. List - its Predefined list dialog containing the entries 01, 02, 03
    3. Free Text defined with the entry - (dash)
    4. Number Range and in its dialog, select the Base option Decimal, select the Ordering option Random, enter Range Start and End values of 1 and 29 respectively, and select Add leading zeros.