PLEASE NOTE: Since we update Flexmonster Pivot with new features biweekly, the information might become outdated. Please check our latest news.

Case study: Connecting Flexmonster Pivot Table to Salesforce CRM

Salesforce CRM is currently one of the most popular cloud services across the world featuring the most robust and "social" tool to salesmen. As they thrive to shift the sales paradigm to Social Enterprise, their tools offers fast and low-cost insight for users.

Connect OLAP data to Pivot Table

From now on, you can directly access Salesforce CRM API and get data directly loaded into Flexmonster Pivot. You can now analyze information with Flexmonster Pivot and access Accounts, Opportunity and any kind of aggregated data with the help of simple script.

In the current showcase we will demonstrate how simple is the setup. For the sake of simplicity, we have chosen PHP as our showcase platform, but practically any language can be used. For complete list of platform that support Salesforce Web Services API, see http://wiki.developerforce.com/page/Integration.

First you would need a Salesforce account which has API enabled and a security token to authenticate via web services. Next, we'll grab a PHP Toolkit which can be obtained via github.

What's convenient about the toolkit is that it already contains examples from test folder, which can be used as basis for your own connector. Our example is based on enterprise.php from same folder:

<?

define("SOAP_CLIENT_BASEDIR", "../soapclient");

// Replace these with your own credentials and don't forget about adding security token to the password
$USERNAME='someuser@domain.com';
$PASSWORD="passwordANDTOKEN";

require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');

$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

// Our sample query gets basic information from Opportunities
$query = "select Name, ExpectedRevenue, CloseDate from Opportunity";
$response = $mySforceConnection->query($query);

// The D+CloseDate formatting of the CSV column would allow Pivot to treat dimension as hierarchy
$csv = "Name,ExpectedRevenue,D+CloseDate\r\n";

foreach ($response->records as $record) {
$date = $record->fields->CloseDate;
date("F",strtotime($date));
$csv .= $record->fields->Name . ",";
$csv .= $record->fields->ExpectedRevenue . ",";
$csv .= date("m/d/Y",strtotime($date)) . ",";
$csv .= "\r\n";
}

// Finally get the output of CSV file
header('Content-type: text/plain');
print $csv;

?>

That’s it. Now basically you’d need to regenerate WSDL if you have additional objects setup and ensure the script is accessible via web and loads data into Flexmonster Pivot Table. You can quickly check this by doing New -> CSV (URL) and copying URL of the script. Pivot will automatically load data and prompt you to setup report layout.

Let us know if this post was helpful to you, please email us.

Subscribe to our news: