I am trying to add a validation trigger where I am attempting to compare the phone number entered on my current object against two other objects for uniqueness. I'm trying to use the rbv_selectQuery API in the trigger and what I'm running into is no matter what I do, it appears the format of the phone is returned in the query, not just the value of the actual phone number. Is this something that can be accomplished? Forcing the format via code is unreliable as it doesn't get applied until leave of the phone field and many of the records we are trying to evaluate are created via import.
Any suggestions would be greatly appreciated.
Could you please try this? The following code get the phone value without special symbols.
var originalPhonenumber=rbv_api.selectQuery("SELECT phoneField FROM ABC where name='xyz'",10);
var phoneNumber= originalPhonenumber.replaceAll("[^0-9]", "");