Managing Protected Fields
Table of сontents
Management of protected fields is identical for the threemodel package and for the legacy package.
Protected fields (regulated fields) are fields that contain information that may be used to identify the person. Due to regulations of different countries, such information must be protected, and in some situations stored in the country of origin.
For each Salesforce object, you can define the protected fields that store the personal identifiable information (PII) or any sensitive information users choose to localize. Such fields will be processed by the package according to the configured data store policy.
Managing protected fields
The package lets you manage protected fields as follows:
Add protected fields for each Salesforce object
Delete the no longer needed protected fields for each Salesforce object
Adding protected fields
On the menu, select Settings and then select the Regulated objects tab.
Select the Salesforce object which protected fields you want to add.
Click Add protected field.
In the Create protected field form, fill out the following parameters:
Field  select the field containing sensitive data that you want to store on the InCountry platform.
Hashing  select the hash function which will be applied to the field value. Ensure that the applied hash function is valid for data contained within the field, otherwise the produced hash value may be inappropriate for storing in Salesforce database as will not match the predefined format pattern.You can use the fixed hash function to apply your own custom value to hashed fields.
Searchable  map the Salesforce protected field to the InCountry record’s field, as follows:
key
 is used to store alphanumeric values. You can have up to 25 searchable protected fields of this type per one Salesforce object.range_key
 is used to store integer and date values for protected fields. You can have up to 10 searchable protected fields of this type per one Salesforce object. Dates when they are saved to therange_key
field are converted to the Unix timestamp format. The total number of thekey
+range_key
fields is controlled by theRestAPIFieldsAvailable
setting in InCountry Value. For example, if you need 25 fields of thekey
type and 10 fields of therange_key
type, the required value forRestAPIFieldsAvailable
must be specified as 35.
Click Save.
Using the improper parameters for protected fields may result in problems with value searchability or record saving.
The newly added protected field will appear on the list with other protected fields that are attributed to the currently selected Salesforce object. These fields will be processed by the package and shown according to the configured data regulation policy.
After generation of the deterministic tokenization key, the two new hash functions will appear in the Create protected field form:
dtkSha256
formula
For the details on generating the deterministic tokenization key, please check our documentation.
Specifics of the dtkSha256
function
THIS FUNCTION BECOMES AVAILABLE AFTER GENERATION OF THE DETERMINISTIC TOKENIZATION KEY.
The dtkSha256
as well as the sha256
function is available only for fields with the length equal to or more than 64 symbols. Protected fields can be configured to apply this new hash function dtkSha256
. In situations, when you need to apply it against fields that accept fewer than 64 characters you need to use the formula
function with the applied character limit.
Specifics of the formula
function
THIS FUNCTION BECOMES AVAILABLE AFTER GENERATION OF THE DETERMINISTIC TOKENIZATION KEY.
The formula
function is an advanced option to redact sensitive values. It allows you to fine tune the hashing function and adjust the outputted redacted value to your actual needs. The formula function can take two functions: sha256
and dtkSha256
.
In addition, you can apply the tranform
function within the formula function to customize the outputted redacted value. It can take an array of transformation functions including toLowerCase
, toUpperCase
, and trim
.
Below you can see an example of the formula
function:
{"fn": "dtkSha256", "transforms": ["trim"], "format":"[AZaz09]{15}"}
Parameter  Description 

fn  The hash function 
transforms  The function which will be applied to the original value. 
format  The postformatting step for hash. AZaz09  the produced hash value will include characters specified within the regular expression.15  field (hash) length. 
When using the formula
function you need to consider the length of the field. The package shows the maximal number of characters as a hint below the Formula text box.
Below is a protected field created with the formula:
Viewing the formula for the protected field
On the menu, select Settings.
On the Regulated objects tab, select the Salesforce object whose protected fields you want to see.
Locate the protected field with the configured formula.
Click the box with the down arrow and then select Show formula.
The View Formula form opens where you can see all the necessary details about the used formula.
The formula function can be comprised of the following constituents:
Parameter  Description 
Function  Name of the function used for redaction of sensitive values. You can use the following:

Transformation functions  Here you can specify additional transformation functions that will be applied to the original sensitive value for data normalization before redaction with the You can use the following:

Field value length  The length of the produced redacted value. By default, the You need to specify it in the following format: When using the 
Regular expression (currently not supported)  This is a rule of how to format the hash value. 
Static text  This text will be appended asis to the redacted value produced by the 
Formula  The original formula 
Below you can see the configuration of the formula
function for the Email and First Name fields.
When creating a new lead, you enter the email address as Useremail@domain.com
.
How this value will be hashed with the formula
function:
The
trim
function is applied to theUseremail@domain.com
value.The
toLowerCase
function is applied to theUseremail@domain.com
value and transforms it touseremail@domain.com
.The
dtkSha256
function produces a hash for the provided value asbc95131c6fb5e2b2c57604d53283eac6f0a0fa05b910830c5f264d24859cb22f
.The
trim
function cuts the hash value to 12 symbols resulting inbc95131c6fb5
.The static text is appended to the hashed value resulting in
bc95131c6fb5@redacted.com
.
Limitations of the formula
function
Only two hash functions are supported:
sha256
anddtkSha256
.If the hash function is
sha256
, then the function will not be deterministic.The length value can be only a number.
When appending a static text string to the redacted value consider the length of the field and adjust the length of the redacted value accordingly.
Selecting hash functions for protected fields inline
You can select or change hash functions for protected fields inline when viewing the list of such fields for a specific Salesforce object.
On the list with protected fields, locate the field for which you want to change the hash function.
Hover over the field with the hash function.
Click the Edit icon.
Select the appropriate hash function.
The selected hash function will be applied to the current protected field.
Supported field types and their hash functions
nothing  fixed  sha256  dtkSha256  uniqueHash  uniqueEmailHash  defaultText  defaultDateTime  defaultBoolean  defaultNumber  random  formula  

Text  
Text Area  
Picklist (singleselect)  
Picklist (MultiSelect)  
Time  
Date OR Date/Time  
Checkbox  
Percent  
Number  
Currency  
Phone  
URL  
Geolocation  
Base64 
Hash function examples
Hash functions work only with values, if there are no values, the hash function is not applied.
Hash function  How it works  Input value  Value saved to Salesforce  Value saved to the InCountry platform  Recommendations 
 The function preserves the original value asis without any changes. 


 Avoid using this hash function for PII data as it does not redact values and keeps the cleartext values in the Salesforce database. 
 The function applies the specified default value to all records making the same dataset store one value. You can adjust the default value depending of the field type. 




When configuring the default fixed value: 10.  
 The function hashes a field value with the SHA256 algorithm and is applicable for text string values only. 




 The function produces the same token for the same value every time you use it. 




 The function hashes a field value with a custom algorithm and appends the current date into the resulting hashed value. It is applicable for text string values only. 




 The function hashes a field value with the SHA256 algorithm and adjusts the hashed value to the email format. 


 Use this function when you perform validation of email address pattern in Salesforce. 
 The function replaces a field value with an empty string. 


 Do not use this hash function for required fields. 
 The function replaces a field value with the default date 




 The function replaces a field value with an empty string. 


 Do not use this hash function for required fields. 
 The function replaces a field value with the default date/time 




 The function replaces a field value with an empty string. 


 Do not use this hash function for required fields. 
 The function replaces a field value with the 




 The function replaces a field value with the 




 The function replaces a field value with some random value. This hash function generates a random alphanumeric string depending on the field type. 







 

@mail.com at the end. 





https:// at the start .com at the end. 




Mapping fields to hash functions
While configuring fields, please consider the using of the proper hash function for a specific data format. For example, if you need to tokenize the email address, you should use uniqueEmailHash function. Otherwise, email address will not be properly handled by Salesforce. For names, use the uniqueHash function.
If you use the redaction data regulation policy, you need to apply the correct hash functions to fields. Please check the mappings of hash functions to fields in the following table:
Internal Salesforce field  UI field  Hash function  Conditions  Notes 

ANYTYPE  N/A  This function is on our roadmap and is not available yet.  
BASE64  N/A  uniqueHash  If the field length is greater than or equal to 50 characters.  Supporting the backward compatibility. 
BASE64  N/A  sha256 dtkSha256  If the field length is greater than or equal to 64 characters.  Supporting the backward compatibility. 
BOOLEAN  Checkbox/0  defaultBoolean  
CALCULATED  N/A  This function is on our roadmap and is not available yet.  
COMBOBOX  N/A  defaultText  
CURRENCY  Currency  defaultNumber  A new function is to be implemented.  
DATACATEGORY REFERENCE  N/A  This function is on our roadmap and is not available yet.  
DATE  Date  defaultDate  
DATETIME  DateTime  defaultDateTime  
DOUBLE  Number  defaultNumber  A new function is to be implemented.  
Email/80  uniqueEmailHash  Use the uniqueEmailHash as the main function for the Email field. It generates the unique hash every time for this field.  
Email/80  sha256EmailHash  Use the sha256EmailHash function to generate the same hash for the same values of this field.  
ENCRYPTEDSTRING  Text (Encrypted)/175  This function is on our roadmap and is not available yet.  
HIERARCHY  N/A  This function is on our roadmap and is not available yet.  
ID  N/A  This function is on our roadmap and is not available yet.  
INTEGER  N/A  defaultNumber  
LOCATION  Geolocation  defaultNumber  A new function is to be implemented.  
LONG  N/A  This function is on our roadmap and is not available yet.  
LOOKUP  N/A  This function is on our roadmap and is not available yet.  
MULTIPICKLIST  Picklist (MultiSelect)/4099  This function is on our roadmap and is not available yet.  
PERCENT  Percent  defaultNumber  A new function is to be implemented.  
PHONE  Phone/40  defaultText  A new function is to be implemented.  
PICKLIST  Picklist/255  sha256 dtkSha256  A new function is to be implemented.Use the sha256 function if the pick list field is not restricted and it can take more than 64 characters. Otherwise use the defaultText function.  
PICKLIST  Picklist/255  defaultText  A new function is to be implemented.  
REFERENCE  Lookup Relationship/18  This function is on our roadmap and is not available yet.  
REFERENCE  External Lookup Relationship  This function is on our roadmap and is not available yet.  
STRING  AutoNumber/30  uniqueHash formula  If the field length is greater than or equal to 50 characters.  Preparing the backward compatibility.Use the uniqueHash function to generate a unique hash value for this field every time. Otherwise use the defaultText function. 
STRING  Text/255  sha256 dtkSha256 formula  If the field length is greater than or equal to 64 characters,  Use the sha256 function if the field can take more than 64 characters. 
STRING  defaultText formula  If the field length is less than 30 characters,  
TEXTAREA  Text Area (Long)/32768  uniqueHash formula  If the field length is greater than or equal to 50 characters.  
TEXTAREA  TextArea/255  sha256 dtkSha256 formula  If the field length is greater than or equal to 64 characters,  
TEXTAREA  Text Area (Rich)/32768  defaultText formula  
TIME  Time  A new function is to be implemented.  
URL  URL/255  sha256 dtkSha256  
URL  URL/255  defaultText  
Specifics of the compound Address field  
STRING  City/40  uniqueHash formula defaultText  
PICKLIST  Accuracy/40  defaultText  Use the sha256 if the picklist field is not restricted and its length is greater than 64 characters. Otherwise use defaultText .  
PICKLIST  Country/80  sha256 dtkSha256 defaultText  Use the sha256 if the picklist field is not restricted and its length is greater than 64 characters. Otherwise use defaultText .  
PICKLIST  CountryCode  sha256 dtkSha256 defaultText  Use the sha256 if the picklist field is not restricted and its length is greater than 64 characters. Otherwise use defaultText .  
DOUBLE  Latitude/18.15  A new function is to be implemented.  
DOUBLE  Longitude/18.15  A new function is to be implemented.  
STRING  PostalCode/20  uniqueHash formula defaultText  
STRING  State/80  uniqueHash sha256 dtkSha256 formula defaultText  
PICKLIST  StateCode  sha256 dtkSha256 defaultText  Use the sha256 if the picklist field is not restricted and its length is greater than 64 characters. Otherwise use defaultText .  
TEXTAREA  Street/255  uniqueHash sha256 dtkSha256 formula defaultText 
Using the fixed hash function
You can use the fixed hash function to apply custom values that you need instead of using the builtin hash functions returning random strings.
This function supports the following fields types:
STRING
TEXTAREA
PICKLIST
MULTIPICKLIST
COMBOBOX
TIME
DATE
DATETIME
BOOLEAN
PERCENT
INTEGER
LONG
DOUBLE
CURRENCY
PHONE
EMAIL
URL
The length of the values that the fixed hash function can apply depends on the field type.
Deleting protected fields
You delete protected fields from the configuration of the InCountry Data Residency for Salesforce package only. These fields will be preserved in Salesforce itself.
You can delete the not needed protected fieds from the data store policy for a specific Salesforce object. Such fields will be no longer protected by the package when showing their values in the interface of Salesforce.
Select the Salesforce object which protected fields you want to delete.
On the list with protected fields, locate the one you want to delete.
Click the box with the down arrow and then select Delete.