You need to sign in to do that
Don't have an account?
D J Roberts
Adding '+' in front of phone number runs SOSL but removal of '+' causes null reference
I have a method that takes a phone number. For the purposes of this thread, I'll call mySOSLMethod(String phone);
It runs this code:
When I try to run this manually, mySOSLMethod('+333222444') it runs successfully but returns an empty list. When I try to use the exact number off the lead record (i.e. '3332224444') the method fails to run and says:
It runs this code:
mySOSLMethod(String phone){ List<List<SObject>> phoneRecords = [ FIND :phone IN PHONE FIELDS RETURNING Lead(Id, Name, WHERE IsConverted = false), Contact(Id) ]; // More code follows here.... return phoneRecords; }
When I try to run this manually, mySOSLMethod('+333222444') it runs successfully but returns an empty list. When I try to use the exact number off the lead record (i.e. '3332224444') the method fails to run and says:
System.NullPointerException: Attempt to de-reference a null objectAny help would be greatly appreciated. Thanks,