Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/18/2024 02:28 AM
Hi,
I need help to shorten or hide the full phone numbers and show only last 3 digits from mail templates. Currently, we are using users.phonenumber (phonenumber: ${users.phonenumber}), which shows the entire number. We want to show only the last 3 digits. For example #######731.
Any help would be appreciated
Thank you
Solved! Go to Solution.
09/18/2024 02:41 AM
if the length is fixed i suggest try using substring function.
09/18/2024 03:17 AM
@Manu269 could you please help with syntax?
09/18/2024 03:37 AM
${requestAccessAttributes.get('Service_Location').substring(0,4)}
09/18/2024 03:42 AM - edited 09/18/2024 03:58 AM
so do I need to use Phonenumber: ${users.phonenumber} and next line with this ${requestAccessAttributes.get('Service_Location').substring(0,4)}?
Please can I have full value where I can mention phonenumber?
I also see in other forum like this ${users.phonenumber{it.toString().indexOf("(") == -1 ? it : it.toString().substring(0, it.toString().indexOf("(") -1)}} . does this works?
09/18/2024 04:42 AM
#######${user.phonenumber.substring(user.phonenumber.length() - 3)}
09/18/2024 05:51 AM
@rushikeshvartak If there is nothing set in the phone number and they have a number in secondary phone field. Can we use like below in same line ? or can we use if statement somewhere?
#######${user.phonenumber.substring(user.phonenumber.length() - 3)} #######${user.secondaryphone.substring(user.secondaryphone.length() - 3)}
09/18/2024 05:56 AM - edited 09/18/2024 05:57 AM
#######${user.phonenumber != null ? user.phonenumber.substring(user.phonenumber.length() - 3) : user.secondaryphone.substring(user.secondaryphone.length() - 3)}
09/19/2024 04:11 AM
@rushikeshvartak Thank you this is working great when you have both Phone number and secondary phone field is set. If either of the phones missing or both phone numbers are missing then it's breaking all other attributes / values also. For example, I set only the secondaryphone field ( no primary phone ) , email I received was below:
09/19/2024 04:54 AM
${user.phonenumber != null ? user.phonenumber.substring(user.phonenumber.length() - 3) : (user.secondaryphone != null ? user.secondaryphone.substring(user.secondaryphone.length() - 3) : 'N/A')}