Dataverse: About Masking Rule ๐Ÿ’Ž

I found an undocumented feature in Dataverse while exploring a topic for today’s blog post. The feature basically helps us to mask the value if the value matches with the RegEx (Regular Expression) that we are set. This feature can be handy if the customer has a strict requirement to not allow anyone to read some type of value. For example, you want to hide Email, Social Security Number, etc.

First, I create a new string attribute named “tmy_demostring” and set the “Enable column security” to check:

Set "Enable column security"

Next, if you go to your Solution page (make.powerapps.com), you can go to New > Security. Here you can create a Secured masking rule and an Attribute masking rule (this means that both components are solution-aware components – you can export it via solution and import it to higher environments):

Create Attribute masking rule and Secured masking rule

For this demo, I created the below Attribute masking rule:

Demo Secured masking rule

As you can see in the above, I created a Regex using “(?<=^.{3}).*(?=@)” which will show the 3 letters of the email and hide the rest. The domain part will not be masked. If you are wondering how I can create it, the answer is just “copilot” your requirement and let the bot give you the possible solutions ๐Ÿคฃ.

In my environment, Microsoft also already gives some Masking rule samples that you can “Advance Find” > Masking Rules:

Sample masking rules

Next, you only need to create an Attribute masking rule. Here is the record I created:

Attribute masking rule

Once the above step is done, you can test the result (if you put email value):

Email

If we put another string value (not email), it will not mask the value:

Even currently this functionality runs on top of the Field Security Profile, it doesn’t respect the rules (the mask feature will always run):

Again, this feature is not yet documented very well (but I found some of the articles that possibly show this feature that you can read here and here).

Happy CRM-ing!

Author: temmyraharjo

Microsoft Dynamics 365 Technical Consultant, KL Power Platform User Community Leader, Student Forever, Test Driven Development, and Human Code enthusiast.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.