We have a requirement to mask the account number entered on Comments which is an text area property. There is no specific format as it is Comments entered by the user. We need to find out whether account number entered or not in comments and if yes need to mask that with only showing last 4 digits. Account number may have more than 9 digits.
For eg: in comments if the user entered like this “act no for Case ID 01 1234567789”
Result should be: act no for Case ID 01 ******7789
I think it has to be handled via Access Control Policy. Please go through the below link, there’s a portion provided for masking each type of char input:
I have gone through the Access Control policy, But it can be helpful if we know the exact characters to be masked . For us the we are not sure the length of characters users will enter as it is an Comments and We need to mask only if the user enter the Account number in it. So not always we will mask this Comments, we need to mask only if the user enters account number in it, also there ay be some other text also present with this account number in the comments.
@SaurabhJ7402 Thank you so much for your response. But in our requirement we are not passing the account number, we are passing the comments which user entered. It will be like 2 to 3 lines of paragraph, in between there comments their might be account number which needs to be masked.
Also I’m not able to find GenerateMaskedString function in 8.8.1 version.
@Umamageswari G Thank you so much, this helps a lot.
This solution will mask all the 9 to 10 numbers in the notes right. Lets say, if a reference number also is entered with account number in the notes, even the reference number will be masked.
@Prabakaran.S Yes. The above regex function will just mask any number of length 9 to 10 as per our specification. We can specify any length range in the function as per requirement.
Pega provides OOTB function @GenerateMaskedString(Param.AccountNumber). It does not depend on string size. It will masked all except last 4 digits. If the input string is “2131232199” then it will return “******2199” as output String.
Function java code is →
Input Parameter : Name - Str / Java type - String
Output : Java data type - String
Classification : Usage type - Output formating
//Generate String masked with * except last 4 digit.
if (Str!=null && Str.length() > 4) {
return Str.replaceAll(“\w(?=\w{4})”, “*”);
}
return Str;
@Umamageswari G In Pega 8.8.1, you can use the pxGetMaskedValue_Text function to mask an account number in a text property.
This function takes several parameters including the string property to be masked, the restriction method, the number of unmasked characters, and the masking character. For example, if you want to mask the first 6 characters of a 10-digit account number and display only the last 4, you can use a call like this: @pxGetMaskedValue_Text(local.instring,"LastN",4,"",0,"X"). Here, local.instring is set to the account number before calling the function.
This is a GenAI-powered tool. All generated answers require validation against the provided references.
In above use case, it will mask any numbers of length 9 to10 and it could be a Case Ref No if the user post it as part of the notes along with the account number right ?