TransWikia.com

how to make phone field unique

Salesforce Asked by Pranav Mandlik on November 19, 2021

i want to make phone field unique for this i have tried triggers but i want to write validation rule for this i have written something like

AND( 
CONTAINS( 
VLOOKUP( 
$ObjectType.Student_Information__c.Fields.Phone_no__c, 
$ObjectType.Student_Information__c.Fields.Phone_no__c, Phone_no__c
), 
Phone_no__c
), 
OR( 
ISNEW(), ISCHANGED(Phone_no__c) 
) 
)

vlookup is not working for phone type field can you please help me with this,

is there any idea that i can make phone field unique ?

2 Answers

Have you considered using duplicate management (i.e., create a matching rule and a duplicate rule) instead of a validation rule? IMHO that feels better for phone numnbers since it would also allow you to change the behavior easily from completely blocking the creation of a new record with a non-unique phone number to just warning the user about a possible duplicate and leaving the choice on how to proceed to the user. After all, phone numbers might not be fully unique (esp. if land lines are included or if you consider a long duration where a cell number might be reassigned to a different subscriber).

Since you can't use VLOOKUP or the unique attribute on data fields of type phone, another option would be to change the data type to text -- but keep in mind that you loose the default functionality of a phone field with this (e.g., you'd have to create a validation rule with REGEX to enforce the format to a legal phone number).

Answered by Miichi on November 19, 2021

Answered by SFDC Prime Squad on November 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP