function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
zas Zhengzas Zheng 

[Lightning Component] How to hide middle 4 number of mobile number?

Hi all,

We are using Open CTI in our system. I have developed a lightning component to display some lead's information in the side bar. In the lightning component I use <lightning:clickToDial value="xxxx"/> to complete the click to dial funtion. And now we need hide the middle  4 numbers of mobile, but I found if I replace the mobile to <lightning:clickToDial value="123****456"/> the click to dial will no longer work. Is there any way to complete this requirement? Thanks.
   <aura:if isTrue="{!not(empty(v.OBcall.Prospect__r.MobilePhone))}">
         <div class="slds-truncate">
             <lightning:clickToDial value="{!'+' + v.OBcall.Prospect__r.MobilePhone}"/>

Khan AnasKhan Anas (Salesforce Developers) 
Hi Zas,

Greetings to you!

As far as I know, you cannot mask the values. And as you mentioned that if you replace with <lightning:clickToDial value="123****456"/> it will not dial the number. Instead of this, you can use a custom button in the lightning component.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

zas Zhengzas Zheng
Hi Khan,


Thanks for your reply, but I don't understand how to fire <lightning:clickToDial /> event through custom button, could you please provide more technical details? Thanks in advance. 

Zas Zheng.
Pranesh Tripathi 21Pranesh Tripathi 21
Hi Zas,

We have similar requirement wherein we need to just mask the middle 4 digits of a number and display it in lightning datatable. Could you guide us as to how you did the masking of the data?