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
paradiseparadise 

Strange error: Expected a hash with key 'type' as first argument

Hi all salesforce experts,
 
    need your help.
 
   In my perl script (using WWW.Salesforce-0.083 module), login and select succeeds, but update operation fails.
 
   Here is my perl codes:
 
   my $sforce = WWW::Salesforce::Simple->new(username,password);  #succeeds
  
   my $result = $sforce->do_query("select .....");   #succeeds
 
   .............   
    my %update_Hash;
    $update_Hash{type} = "Account";
    $update_Hash{Id} = "0017000000LKqSuAAL";  #a real ID gotten from query
    $update_Hash{"Site"} = "Testing sites";
 
    my $res = $sforce->update(%update_Hash);  #fails here with error message "Expected a hash with key 'type' .....
    print "Update result = $res\n";
 
Why ?
How to solve ?
 
 
werewolfwerewolf
Maybe you need to put your hash keys in quotes?

    $update_Hash{"type"} = "Account";
    $update_Hash{"Id"} = "0017000000LKqSuAAL";  #a real ID gotten from query

paradiseparadise
 
    Thanks for your reply.
 
    I tried/tested what you suggested, but still failed.
 
    I also notice the same error was reported by some one on the following URL (at the foot part).
 
 
 
Does that means the perl module doesn't work for updating operation ?
 
 
VrecanVrecan
I get the exact same error, I am at a loss on how to fix this issue. Even trying to do a simple update causes this problem.
jprosserjprosser
What I did was this:
$objType = "object_name"; #or maybe "my_object_name__c"

 $result = $sforce->update(('type' ,$objType),%data);

#%data is the hash with attribute value pairs for the object.
# This forces the 'type' entry to be the first one in the hashtable

HTH
-Joe