You need to sign in to do that
Don't have an account?
ltcommander
Getting results from Perl Sub Query
Hi,
I am a bit of an amateur coder so please forgive my ignorance.
I am trying to have the results of a sub query returned in Perl.
my $result = $sforce->do_query("Select FirstName,Account.Name,LastName,Title,Description,(SELECT Note.Body,Note.Title FROM Contact.Notes where Note.title like '%resume%') From Contact where FirstName like '%abcd%'");
foreach my $row (@$result) {
print $row->{FirstName}.";".$row->{LastName}.";".$row->{Notes}.";\n";
...
I get this:
abcde;test;QueryResult=HASH(0x...)
How do I get the results of the query, i.e. the Note Body and Note Title now?
Thanks!
I am a bit of an amateur coder so please forgive my ignorance.
I am trying to have the results of a sub query returned in Perl.
my $result = $sforce->do_query("Select FirstName,Account.Name,LastName,Title,Description,(SELECT Note.Body,Note.Title FROM Contact.Notes where Note.title like '%resume%') From Contact where FirstName like '%abcd%'");
foreach my $row (@$result) {
print $row->{FirstName}.";".$row->{LastName}.";".$row->{Notes}.";\n";
...
I get this:
abcde;test;QueryResult=HASH(0x...)
How do I get the results of the query, i.e. the Note Body and Note Title now?
Thanks!
Hi ,
i am new to salesforce .
We are using the WWW::Salesforce PERL package to connect to the Salesforce Portal . Could you tell me what you did
to connect to salesforce (any change in the package etc.)
Initially we had problem in connecting to the Salesforce portal itself , then we changed the proxy from https:// to http:// and we got connection to the salesforce. We got session Id also .
After that when we try to querythe salesforce our program aborts saying
"500 Connect failed: connect: Connection refused; Connection refused at //pkgs/linux/intel/perlmods_intcrm/5.8.8.rhas3.x86/lib/site_perl//5.8.8/WWW/Salesforce.pm line 518"
If we go to the line number 518 of Salesforce package , it corresponds the session_header call.The corresponding code is
my $client = $self->get_client();
my $r = $client->query(
SOAP::Data->name( 'queryString' => $in{'query'} ),
$limit,
$self->get_session_header()
);
Then we used data dumper to see what the "sforce" variable in query passes ,
$VAR1 = bless( {
'sf_uid' => '00520000000nkSBAAY',
'sf_pass' => 'password',
'sf_sid' => '440400D200000000CXT!AREAQPvnCxWV3G0NLeGmDM.ie7AD5lJ4h_.swzsS486oT8ZqhRXr9WvnlnCfXlzbKUWhPEW0B2CMbwXjH1Z6ITWCAMuRnNhd',
'sf_serverurl' => 'http://eu0-api.salesforce.com/services/Soap/u/8.0/440400D200000000CXT',
'sf_user' => 'username' <mailto:'enquiry-asia@etrade.com'>
}, 'WWW::Salesforce' );
Our sample code is
use WWW::Salesforce;
use Data::Dumper;
use Crypt::SSLeay;
my $sforce = WWW::Salesforce->login( username => '', password => '' ) or die "not connectedte $!";
print "connected \n";
my $query = "SELECT Id,Name FROM Account";
print Dumper($sforce);
my $result = $sforce->search('searchString' => $query);
#-------------------------------------------------------------
sub Connect {
#-------------------------------------------------------------
# Authenticate with the Salesforce API based on command line parameters.
$sforce = WWW::Salesforce::Simple->new(
'username' => 'dude@dude.com',
'password' => 'password@password.com'
);
}
my $result = $sforce->do_query("Select Title,Body from Note where ParentId='$IDVal'");
foreach my $row(@$result) {
...
You have to add the security token to it.
i.e. if the password is "Password" and the token is "010Z", the password would be "Password010Z"
I did not change anything at the package level
Did you try from a different computer under different network settings?
My guess is that it is more of a connection issue not a package issue.
I am using my organization network (It is in trusted connection) ....