use WWW::Salesforce;
my $username = '<UserName>';
my $password = '<Password>';
my $security = '<Token>';
my $stoken = "$password$security";
# Authenticate with the Salesforce API
my $sforce = eval { WWW::Salesforce->login (
username => $username,
password => $stoken );
};
die "Could not login to Salesforce: $@" if $@;
my $query = "SELECT Id, Name, Email, AccountId FROM Contact";
my $res = $sforce->do_query( $query );
open(FH, '>:encoding(UTF-8)', "SF_Report.csv")
or die "Could not open file: \"SF_Report.csv\"";
foreach my $field (@$res) {
print FH "$field->{'Name'},$field->{'Email'},$field->{'AccountId'}\n";
}
my $username = '<UserName>';
my $password = '<Password>';
my $security = '<Token>';
my $stoken = "$password$security";
# Authenticate with the Salesforce API
my $sforce = eval { WWW::Salesforce->login (
username => $username,
password => $stoken );
};
die "Could not login to Salesforce: $@" if $@;
my $query = "SELECT Id, Name, Email, AccountId FROM Contact";
my $res = $sforce->do_query( $query );
open(FH, '>:encoding(UTF-8)', "SF_Report.csv")
or die "Could not open file: \"SF_Report.csv\"";
foreach my $field (@$res) {
print FH "$field->{'Name'},$field->{'Email'},$field->{'AccountId'}\n";
}