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
bildbild 

PERL: Fields of type 'phone' require at least one non-numeric.

I doubt this is simply a perl problem.

When creating Contact or Lead objects, if the 'phone' field was passed as a simple string of numbers, with no spaces, dashes, or other non-numeric characters, the create will fail with the error message:

value not of required type

People filling out web forms with free-form inputs for the phone field (which are pretty well required if you have international customers) often type in something like:

2125551234

... which is a valid US phone number.

If I add a space, or any other non-numeric character to the field before sending it to create, it works fine. This seems like a bug to me.

My current workaround for this is to check the phone number, and if it contains no spaces, to add one. This is slightly lame, but it works.
Ron HessRon Hess
it's perl, or SOAP::Lite really

the Seralizer for SOAP::Lite thinks this is a number given that there are no other clues and it doesn't have a full description of the field so it gueses by looking at the content before stuffing these numbers into a soap data type. you can override this with something like this;

$Salesforce::Constants::TYPES{Contact}->{Phone} = 'xsd:string';

then the serializer can discover that this is a string and not pump it into a soap number, which a phone number is not.

when you include any non numberics, it falls back to string, so it works as you discovered.