Reply
Regular Visitor
Sabih
Posts: 2
0

Error while updating using PERL

I am using Developer's 30 days trial version and can query data from SF for display. While trying to update the Lead table using PERL (WWW::Salesforce::Simple) I am getting the error. 

 

Lead: bad field names on insert/update call: type

 

I have double checked and every thing seems to be in order as far as the hash is concerned. Could it be the lack of update/insert access in the trial version or am I missing some thing?

 

my %newdata;

$newdata{"Email"}=$Email;
$newdata{"id"}=$id;
$newdata{"LeadSource"}=$LeadSource;
$newdata{"FirstName"}=$FirstName;
$newdata{"LastName"}=$LastName;

# update existing record

$result = $sforce->update(type => 'lead',%newdata);

if ($result->result->{"success"} eq "false") {
print $result->result->{errors}->{message} . "\n";
}

 

 

The $result hash has the following error message:

 

undef,
{
'fields' => 'type',
'statusCode' => 'INVALID_FIELD_FOR_INSERT_UPDATE',
'message' => 'Lead: bad field names on insert/update call: type'
},

 

Visitor
jimmy chen
Posts: 4
0

Re: Error while updating using PERL

try 

$newdata{"id"}=$id;

$newdata{"Email"}=$Email;
$newdata{"LeadSource"}=$LeadSource;
$newdata{"FirstName"}=$FirstName;
$newdata{"LastName"}=$LastName;

 

I believe that after type,  ID must be next hash field.