Get phone value using selectQuery

Posted by on 03-Oct-2016 12:57

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.



All Replies

Posted by Shiva Duriseati on 04-Oct-2016 08:47

Hi Jason,

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[0][0].replaceAll("[^0-9]", "");




This thread is closed