Reply
Regular Visitor
emale
Posts: 2
0
Accepted Solution

Value doesn't match the required type (Perl)

I'm new to salesforce and it seems I'm overlooking something obvious because I can't find any other thread with this problem:

 

Created a user-defined field "External_ID" in "Leads", type integer (8,0). Now I want to create a new lead with WWW::Salesforce::Simple

 

my $row->{id} = int(12);
my %lead = (type => "Lead",
	 External_ID__c => $row->{ID}, # <-- Doesn't work for me  --
	 Company	=> $row->{CNAME},
	 LastName	=> $row->{LNAME},
NumberOfEmployees => 12 # <-- That works! Same type but system field, not user-defined --
#...and so on...
);

 

But I'm getting the error message "Value doesn't match the required field type" (something like this - translated from german).

I'm submitting an integer value and the field is integer. What am I doing wrong?

Also replaced the $row->{ID}-variable with 12 and "12" (with and without quotes) - all the same error message.

Changed the field type to string but it doesn't accept "12" as well. Interestingly it accepts "abc" as expected.

 

Actually this value comes from a database like all other values and it's also definitively an integer value in the database but didn't worked either. So that's why there's that line my $row->{id} = int(12) ;-)

 

What else can I do to save an integer value in an integer field?

 

Setting NumberOfEmployees to 12 curiously works. That's also an integer field and I'm ging an integer value, but it's a system field and no user-defined field.

I would suggest that something's wrong with that user-defined field. But there's not much I can adjust. I can adjust that it's integer and that there may be up to 8 digits. Doesn't seem to be a big source of errors...

Regular Visitor
emale
Posts: 2
0

Re: Value doesn't match the required type (Perl)

[ Edited ]

Okay, stumbled upon the solution by trying to clarify another question. Seems to be a problem of WWW::Salesforce::Simple.

Already discussed here but wasn't able to find it because I've searched for terms like "custom field" and "field type" :-/

 

So I just had to prebend the line 

 

WWW::Salesforce::Constants->register_type("Lead", "External_ID__c", "xsd:double"); 

 

now it works like expected.