Step 2: Specify Object & Field Masking


Overview –

To achieve scalability and high performance, you can split records of the same objects into different chunks. 

For example, the Contact object contains 18 million records which are equally distributed over three years. Suppose we then decide to split the Contact object into three unique mappings – this means that each mapping will now have six million records. This split allows the processing of all three batches of six million records simultaneously instead of processing one contact masking batch containing all 18 million records. This can be done for up to five different mappings on one object. 

Enable Object Multiple Mapping from custom Metadata.

To enable this object multiple mapping, navigate to ‘Setup’  -> ‘Custom Metadata’ -> ‘DM App Configure’ -> Object Multiple should be set to “True”.

Solution :

After the creation of the Configuration record, you need to add objects and fields to the object masking and field masking records.

The following steps cover how to create these object masking and field masking records.

Object Masking

Step 1: Navigate to the ‘Configuration’ tab

Click on the ‘Configuration’. You will now see all of the configurations that you have created.

Step 2: Navigate to the ‘Object Masking’ section

Click on any configuration record and scroll down to the ‘Object Masking’ section.

Step 3: Create an Object Masking record

Click the ‘New’ button to add an Object Masking record.

You will then be prompted to select a record type: ‘Delete Records’ or ‘Mask Records’ 

Delete Records: If you want to delete records, select the ‘Delete Records’ button and click ‘Next’. By doing this, the Delete Records Page Layout will display.

Mask Records: If you want to mask records, then select the “Mask Records” radio button. By clicking on this, the Mask Records Page Layout will display.

Select an Object and determine Group, Sequence, Batch Size, and Filter Criteria, then select the ‘Use Bulk API’ checkbox. This allows you to process records in bulk and improve masking performance.

  • Group

The Group criteria decides masking priority. That means objects that are added in Group 1 will be masked first, followed by objects in Group 2, and so on up to Group 10. You can add an unlimited amount of objects in a single Group and put Standard as well as Custom Objects in the same Group or a different Group

  • Sequence

The Sequence criteria works within different Groups. The Sequence criteria allows you to decide the priority for an object to be masked within a Group. For example – an object which has a Sequence value of 1 will be masked first, and so on for an infinite number of values. Manually, you may set as many sequences in a single group on both Standard and Custom Objects. 

  • Batch size

The Batch Size determines the number of records that should be processed in a single batch. You can set it from a minimum value of 1 to a maximum of 2000 records. 

  • Filter Criteria

The Filter Criteria allows you to filter records by entering a WHERE clause. One example of how the Filter Criteria can be utilized is to filter which records with a certain name should be processed. To filter a name like ‘John’, the filter criteria should be something like FirstName = ‘John’. As a result, masking will be performed only on records where the FirstName field is equal to ‘John’.



Step 4:
Save your changes

Click on ‘Save’. Likewise, you can create multiple records of object masking with different groups and sequences.

Field Masking

Step 4.1: Pick an Object

Click on the Object name for which the user wants to add Field masking. You will be redirected to the field masking page.

Step 4.2: Choose Fields

To add fields to the masking, click on the ‘New’ button.

Select from any of the below actions:

1. Erase: To erase the field values.

2. Replace: To replace the field values with another value from the option provided by DataMasker.

If you select Erase, select the field from the dropdown list and click ‘Save’. This function is used to erase the field (e.g. name, number, email, address, etc.) 

Note – Never add mandatory fields under erase action.

If you select Replace, select one of the following further actions:

I. Random: Replace with randomized(autogenerated) text/string. 

II. Hardcoded: Replace with a hardcoded string.

III. Pattern: Replace with a custom list or Regex.

IV. Apex: Replace with specific characters.

Hardcoded Value: Hardcoded values are values where you can add any hardcoded text/string to replace the actual value with chosen one.

Select the field where you want to apply masking to and click ‘Save’. Repeat this until desired field maskings are set up.

Enter any String in the ‘Enter Value’ textbox field by which you want to hardcode the selected field. Make sure the value entered in the textbox is of the same data type of the field selected for masking.

In the following example, the output is masked.

While selecting ‘Pattern – Custom List’ from further actions, choose the value by which you want to replace the selected field by using patterns. 

A Pattern – Custom List can be any combination of items or names from the default list or the lists created by the users.

Pattern – Regex:- While Selecting ‘Pattern – Regex’ from further actions, choose the value by which you want to replace the selected field by using patterns from your sandbox (e.g. email, phone number, etc.).

You can also add your own Masking Pattern. Refer to the article linked here.

Random:- While selecting ‘Random’ from further actions,  choose the field by which you want to replace the selected field with a Random text/string.

Apex:- While selecting ‘Apex’ from further actions, choose the field by which you want to replace the selected field with Apex texts/strings. For more information, click here.

After adding all fields, you can see a list of your field maskings as shown.

Special Use Case – User Masking

Masking User records is considered one of the best ways to protect the personal information of org’s users. When utilized, Salesforce permanently scrambles the user’s object data and replaces it with random character strings. The user’s detail page exists, but all of its fields will contain meaningless strings of characters. Salesforce simply obfuscates or scrambles personal data because you can’t delete a user in Salesforce; you can only disable or deactivate a user. In other words, the user record still remains in the database, but this method performs a soft delete. This masking process does not work on Custom fields.

For further information on this case, click here.

Powered by BetterDocs