• Bolton
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies

Hello,

 

I'm sure we're missing something blindingly obvious here. We have a trivial little perl script using WWW::Salesforce::Simple, to update a custom object.

 

We have a test case setup, as follows:

 

 

 

$WWW::Salesforce::Constants::TYPES{Data_Questionnaire__c}->{Custom_Number__c} = 'xsd:double'; $WWW::Salesforce::Constants::TYPES{Data_Questionnaire__c}->{Custom_Results__c} = 'xsd:string'; my %data = ( id => $id, Custom_Number__c => 5, Custom_Results__c => 'http://someurl.com' ); my $result = $sf->update(type => 'Data_Questionnaire__c', %data);

 

We receive the following error, despite ensuring the the type is of 'xsd::double', and the custom field 'Custom__Number__c' is of type Numeric:

Custom Number: value not of required type: 5

 


Has anyone experienced this issue before? Any information would be greatly appreciated.

 

  • February 18, 2009
  • Like
  • 0

Hi There,

 

First time on this board so sorry if this problem has been posed before.  There are a few threads detailing upsert, but no sample code for working stuff in Perl's WWW::Salesforce library.  Here is what I have so far:

 

 

my %account; $account{"type"} = "Account"; $account{"FirstName"} = "NewFirstname"; $account{"LastName"} = "NewLastname"; $account{"RecordTypeId"} = $rti; $account{"My_ID__c"} = $my_id; $result = $sforce->upsert((type => "Account"), "My_ID__c","", (%account)); if ($result->result->{"success"} eq "false") { print $result->result->{errors}->{message} . "\n"; }

 

The reason I have the following as my upsert function: 

$sforce->upsert((type => "Account"), "My_ID__c","", (%account))

 

Is becase it's the only one that does not complain of missing types, keys, etc.  So anyway, when I run my Perl script, I get the following:

 

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

 

What am I doing wrong with my code?  Can someone give me a simple example of how upsert should be used in Perl?

 

Thanks!

Hello all,

 

I am attempting to make a connection to our SandBox environment programatically with the API.


When I connected to our production environment, I did so using PERL as follows:


use WWW::Salesforce::Simple;

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



the wsdl.jsp file contains the line:

<port binding="tns:SoapBinding" name="Soap">
   <soap:address location="https://www.salesforce.com/services/Soap/c/15.0"/>
</port>

This worked fine.


However, what I want to do is connect to the SandBox environment.


I appended  ".<our sandbox name>"   to the end of the username.
(I was able to login successfully with this username and it's password at https://test.salesforce.com with

a Web browser so I know my credentials are correct).


In the wsdl.jsp file I tried both the above snippet as well as:



<port binding="tns:SoapBinding" name="Soap">
   <soap:address location="https://test.salesforce.com/services/Soap/c/15.0"/>
</port>


My Perl script that I am using to try to connect is:

#!/usr/bin/perl -w
use strict;

use WWW::Salesforce::Simple;


my $user = '<the username I successfully used on Web browser with sandbox name appended>';
my $pass = '<our password>';

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


print "done\n";




When I run this script I get the following error:

INVALID_LOGIN: Invalid username or password or locked out. at ./connect.pl line 10

 

Not sure how to resolve this. Any assistance with this would be greatly appreciated.

 

 

Regards,

 

RanS

  • February 26, 2009
  • Like
  • 0

New to this so appologies if I'm doing something stupid.

 

Running the following:

 

use strict;
use WWW::Salesforce::Simple;


# Authenticate with the Salesforce

 

my $sforce = WWW::Salesforce::Simple->new(
        'username' => '*****',
        'password' => '*****'
) or die 'failed sf login'.$!;

my %lead=();

%lead = (
        'email' => 'testtestcom',
        'leadsource' => 'WebRegistration',
        'company' => 'TestCo',
        'country' => 'US',
        'firstname' => 'Test',
        'lastname' => 'Person'

);

my $result = $sforce->create(type => 'lead',%lead);

 

 

and get the error: 

> Missing entity type information. sObject requires a separate 'type' field be sent. at sf2.pl line 30

 

Any ideas?

 

While I'm at it, are there any decent docs on using Perl with salesforce with code examples of queries ,inserts & creates etc? There doesn't seem to be much around.

 

Thanks in advance.

 

G

Hello,

 

I'm sure we're missing something blindingly obvious here. We have a trivial little perl script using WWW::Salesforce::Simple, to update a custom object.

 

We have a test case setup, as follows:

 

 

 

$WWW::Salesforce::Constants::TYPES{Data_Questionnaire__c}->{Custom_Number__c} = 'xsd:double'; $WWW::Salesforce::Constants::TYPES{Data_Questionnaire__c}->{Custom_Results__c} = 'xsd:string'; my %data = ( id => $id, Custom_Number__c => 5, Custom_Results__c => 'http://someurl.com' ); my $result = $sf->update(type => 'Data_Questionnaire__c', %data);

 

We receive the following error, despite ensuring the the type is of 'xsd::double', and the custom field 'Custom__Number__c' is of type Numeric:

Custom Number: value not of required type: 5

 


Has anyone experienced this issue before? Any information would be greatly appreciated.

 

  • February 18, 2009
  • Like
  • 0