Enterprise Connector FireDAC Components for Salesforce 2017

Posted by on in Blogs

When we think of Salesforce, we typically think of its main use case; pulling together relevant information for sales so they can track and close deals. However, Customer Relationship Management (CRM) systems hold a great value for other members of your company as well. CRM is a term that refers to practices, strategies, and technologies that companies use to manage and analyze customer interactions and data throughout the customer lifecycle, with the goal of improving business relationships with customers, assisting in customer retention and driving sales growth. 

The Embarcadero Enterprise Connector for Salesforce 2017 allows you to use Embarcadero FireDAC classes to build applications with bi-directional access to Salesforce. FireDAC provides a unified, high-performance data access layer for working with enterprise databases in RAD Studio. The components abstract the underlying data source into tables, views, and stored procedures that can be used to both retrieve and update data.

This post describes how to install and use Embarcadero's Enterprise Connector for Salesforce Components for RAD Studio, Delphi and/or C++ Builder.

Standard FireDAC Components

Just like connecting with a typical RDBMS like InterBase, MySQL. or SQL Server. You can use standard FireDAC components like TDFManager, TDFConnection, TDFQuery, etc.

CDataFireDAC

Type SQL, Get Salesforce Data

The easiest way to build data-centric applications. You write standard SQL queries to interact with Salesforce, just like working with any RDBMS. The Enterprise Connectors supports SQL joins, updates, aggregation, and more:

SQL_Salesforce

 Getting Started

The Enterprise Connector FireDAC Components for Salesforce 2017 integrates Salesforce into RAD Studio, Delphi and/or C++ Builder. The component requires the Web Services API. The Web Services API is supported natively by Salesforce Enterprise, Unlimited, and Developer editions. The Web Services API may be enabled on Professional Edition at an additional cost by contacting Salesforce. The component defaults to version 40.0 of the Salesforce API. Later or earlier versions can be specified in the APIVersion property.

Install Enterprise Connector Salesforce Components into RAD Studio, Delphi and/or C++ Builder

Use the Getit Package Manager and install CData Enterprise Connector FireDAC Components for Salesforce 2017.

EC_SalesForce

After the install, demos, help and source code will get installed, by default into folder:  C:Program FilesCDataCData FireDAC Components for Salesforce

ConsoleSample Application

You can test the CData FireDAC Components for Salesforce by running the sample Delphi Console Application located at:

C:Program FilesCDataCData FireDAC Components for SalesforcedemosConsoleSample

 1. Open project in RAD Studio or Delphi:

 EC_DelphiConsoleSample

2. Run the Application:

EC_SalesforceConsoleRunning

3. SalesForce Data gets returned:

EC_SalesForceData

Notes for User Access:

1. You need to provide you Salesforce Username and Password and Security Token.

 

2. When accessing Salesforce--either via a desktop client or the API--from outside of your company’s trusted networks, you must add a security token to your password to log in. To get your new security token, log in to Salesforce. From your personal settings (My Settings):

SalesForceMyProfile   SalesForceSecurityToken

Enter Reset My Security Token in the Quick Find box, then select Reset My Security Token.

ResetSecurityToken

Click the Reset Security Token button, and Salesforce will email you your new security token:

From: "This email address is being protected from spambots. You need JavaScript enabled to view it."

 

Subject: Your new Salesforce security token

We've sent you a new Salesforce security token because you recently changed your password or requested to reset your security token. Use this updated security token with API or desktop clients that require it.

Username:

Security token (case-sensitive): kenue36dn8a7qn7az90

NOTE:  By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses:

To disable the security token, log into Salesforce and in the setup section enter "Network Access" in the Quick Find box. Add your IP address to the list of trusted IP addresses.

Another option is Authenticating with OAuth

If you do not have access to the username and password or do not wish to require them, you can use the OAuth user consent flow. See Using OAuth in the Enterprise Connector for SalesForce Help file for a guide.

 

Creating VCL or FireMonkey Applications to use the Enterprise Connector for SalesForce

This section shows how to use the RAD Studio Form Designer to create a Forms application that shows the basic FireDAC objects needed to connect to Salesforce from any application.

1. Using RAD Studio, Delphi or C++ Builder, in the Project Manager, Data Explorer FireDAC, Right-Click on the CData Salesforce Data Source | Add New Connection

CDataSalesForceConnection

For example, you can name it MySalesForce:

AddConnection

Click OK.

MySalesForce

Right-Click the MySalesForce connection | Modify

In the FireDAC connection Editor, enter your SalesForce User, Password and Security Token.

FDEditorSalesForce

 Click the Test button.  You may be prompted to enter your SalesForce Password for the FireDAC Login dialog:

SalesforcePassword

Click OK, and verify Successful Connection!

ConnectSuccess

Congratulations!

Now, in Data Explorer, if you expand your MySalesForce connection node, you will see all the Tables, Views, and Procedures that you have available for SQL against your SalesForce.com:

DataExploreSalesForce

For example:

DataExploreExpand

You can write SQL against these SalesForce tables including Select, Update, Insert and Delete, and also Inner Joins, Aggregate functions, executing Stored Procedures, and more.

The Enterprise Connector for SalesForce exposes the SalesForce data as high-level mappings to SalesForce data. The Salesforce Object is represented as a Table with Records.

The DataExplorer shows you the SalesForce Tables, Views and Stored Procedures, that you can drag-and-drop onto your RAD Studio forms to auto-create the necessary FDConnection and FDQuery or FDTable components.

FDConnectTable

For Stored Procedures, for example, the GetCustomReport stored proc that lets you execute a Salesforce Report and get the results in a dataset. So you can drop a TFDStoreProc component on your form and call the GetCustomReport stored proc and display the results on grid!

GetCustomReport

FDStoreProc

2. Create a New VCL Forms Application (Delphi or C++ Builder).

3. From the Data Explorer Tab, drop the SalesForce CData.SalesForce.Account Table onto your VCL Form:

CDataAccountTable

4. This will add the FireDAC MySalesForce Connection and FireDAC Account Table components onto your VCL Form:

 FDAccountTable

 5. Add a DBGrid and DataSource component onto the Form:

CDataDBGrid

6. For the SQL property of the AccountTable, enter:  SELECT Name, MAX(AnnualRevenue) FROM Account GROUP BY Name Limit 10

7. Run the application and see the SalesForce Data displayed on your DBGrid, like this:

 

CDataSalesForceGreen

That’s it!  That is how easy it is to use Embarcadero’s Enterprise Connector for SalesForce with RAD Studio, Delphi and/or C++ Builder to connect and access SalesForce data!

 

 



About
Gold User, Rank: 90, Points: 4
Al Mannarino has 25+ years of software development experience, including object-oriented analysis and design (OOAD) and developing and deploying production applications. He is currently a Principal Software Consultant and Evangelist for Embarcadero Technologies. Prior to joining Embarcadero, Al spent three years working with CodeGear, a division of Borland that was acquired by Embarcadero in 2008. He also worked for five years as a lead systems engineer for Borland supporting application lifecycle management, software delivery optimization and developer tools solutions. Prior to Borland, Al served as a systems engineer for companies including Objectivity, Versant, Red Brick Systems, Information Builders, and was an electrical engineer for Grumman Aerospace performing application implementations on complex electrical-mechanical systems. Al has a bachelor's of science degree in electrical engineering from Manhattan College.

Comments

Check out more tips and tricks in this development video: