• m0joe
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi, I'm just starting out with the WWW::Salesforce perl module and I'm finding that I can read data out of Salesforce but my update() calls don't seem to be having any effect.  I'm getting a '1' back from the update() call and no errors, but the data doesn't get changed:

 

==================================================

 

#!/usr/bin/perl -w
# -*- Mode: perl; indent-tabs-mode: nil -*-

use diagnostics;
use strict;

use lib "../lib";

use WWW::Salesforce::Simple;
use Data::Dumper;

my $sforce = WWW::Salesforce::Simple->new(
                                          'username' => 'xxx',
                                          'password' => 'yyy'
                                          );

my $id = '00530000001jhJiAAI';
my $query = "select Id, FirstName, LastName, PostalCode from User where Id='$id'";
my $res = $sforce->do_query( $query );
print Dumper($res->[0]);

my $update = {};
$update->{id} = $id;
$update->{PostalCode} = '80304';
$res = $sforce->update(type => 'User', $update);
print "Got result: $res\n";

$res = $sforce->do_query( $query );
print Dumper($res->[0]);

 

==================================================

 

As I said above, I'm getting back a success response code and no errors.  Is there an API log visible through the UI or anything like that?  I've logged in to the UI with this username and password and changed some of the address info, so I don't think this is a permissions issue.

 

Thanks,

-Chris

 

Message Edited by DirectResponse on 03-20-2009 12:25 PM
Hello,
 
I am using the SalesForce.pm module to pull down some data using the API.  I want to store the SalesForce ID (which is a character field), but when I read the value using the perl API, I get the Id values back as:  ARRAY(0x35b8370), etc.
 
I'm using the example code from another post to hit the api and populate an array to return the data, such as:
 
Code:
my @records = QuerySF("select * from Opportunity");
foreach my $rec (@records)
{
      print "$rec->{Id}";
}

sub QuerySF 
{ 
 my $soql = shift;  
 my $lim = '2000'; 
 my $q = $sf->query( query =>$soql, limit => $lim );
 my @trans = $q->valueof('//records');
  
 while ( 'false' eq $q->valueof('//done') ) 
 { 
  # query more
  $q = $sf->queryMore( queryLocator => $q->valueof('//queryLocator'), limit => $lim ); 
  my @more = $q->valueof('//records');
  push @trans, @more;
 } 
 return @trans;
}

 
any ideas?  I'm fairly new to Perl, so perhaps I'm missing something.
 
thank you!