Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Hide phone number from email template

Study_Saviynt
New Contributor II
New Contributor II

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 

 

 

9 REPLIES 9

Manu269
All-Star
All-Star

if the length is fixed i suggest try using substring function.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

@Manu269  could you please help with syntax?

Manu269
All-Star
All-Star

${requestAccessAttributes.get('Service_Location').substring(0,4)}

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

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?

 

rushikeshvartak
All-Star
All-Star

rushikeshvartak_0-1726659678330.png

rushikeshvartak_1-1726659694698.png

 

#######${user.phonenumber.substring(user.phonenumber.length() - 3)}

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@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)}

#######${user.phonenumber != null ? user.phonenumber.substring(user.phonenumber.length() - 3) : user.secondaryphone.substring(user.secondaryphone.length() - 3)}


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@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: 

saransavi_0-1726744121599.png

 

${user.phonenumber != null ? user.phonenumber.substring(user.phonenumber.length() - 3) : (user.secondaryphone != null ? user.secondaryphone.substring(user.secondaryphone.length() - 3) : 'N/A')}


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.