DZone
Integration Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Integration Zone > How to Develope Apps With Salesforce CRM Integration in Delphi

How to Develope Apps With Salesforce CRM Integration in Delphi

It;s often necessary to work directly with data stored in the cloud without using original web interfaces or custom APIs. Let’s create a small application as an example.

Jordan Sanders user avatar by
Jordan Sanders
·
Feb. 20, 17 · Integration Zone · Tutorial
Like (1)
Save
Tweet
4.64K Views

Join the DZone community and get the full member experience.

Join For Free

Cloud-based CRM systems are becoming incredibly popular in these days. This trend is quite clear. The use of cloud services does not require deployment or costly specialized software domestic support that ultimately reduce a company’s total expenses.

Despite flexibility and ease of use, it is often necessary to work directly with data stored in the cloud without using original web interfaces or custom APIs. It can be any analytical studies, statistical data processing, or creating certain forms of reporting documentation.

In this case, a developer will find it more convenient to work using familiar tools. Various APIs and different access methods to Cloud CRM data can significantly complicate this process because in most cases, they are not universal. ODBC technology can provide a standard interface to access any databases, including the cloud.

UniDAC components allow you to work in Delphi with any ODBC driver. For this, UniDAC includes a special component: TODBCUniProvider. Let’s see how to work with data stored in Salesforce. First, you need to install and configure any ODBC driver working with Salesforce (for example, Devart ODBC Driver for Salesforce).

As an example, let’s create a small application that implements a master-detail connection between two standard Salesforce objects: Account and Opportunity. Account will be represented by a master dataset and Opportunity, by a detail dataset. The AccountId field will be used for communication between the entities.

The order of actions will be as follows.

1. Download and Install ODBC Driver for Salesforce

This is pretty straightforward.

2. Configure It to Work With the Salesforce Account

You can find the detailed instruction here. Before using the datasource named Devart Salesforce Driver created at this stage, you can check its setting with the help of the Test connection button.

3. Create a Project

Open IDE and create a small project containing the following components:

4. Configuration

To work with the ODBC driver, configure TUniConnection as follows:

uses ODBCUniProvider;
...
UniConnection.ProviderName: = 'ODBC';
UniConnection.Server: = 'Devart Salesforce Driver';

In this case, in the UniConnection.Server property, we specified DSN, which we created in Step 2. Note that you can also work with a required ODBC driver, using UniConnection without explicitly specifying DSN. To do this, you should fill the appropriate parameters in the ConnectString property. To work with Devart ODBC Driver for Salesforce, this property will look as follows:

UniConnection.ConnectString := 'Provider Name=ODBC;Server="DRIVER={Devart ODBC Driver for Salesforce};Data Source=login.salesforce.com;User ID=;Password=;Security Token="';

5. Compose Necessary SQL Queries

AccountQuery.SQL.Text := 'Select Id, Name, BillingStreet, BillingState, WebSite From Account';
OpportunityQuery.SQL.Text := 'Select Name, StageName, Amount, Type, Description From Opportunity Where AccountId = :Id';

Note that in both queries, we did not use all the fields of the  Account and Opportunity objects, but only those needed for the demonstration. In addition, to implement the master-detail connection, we added the appropriate Where clause.

6. Configure a Query Relationship

Configure a master-detail relationship between the queries:

AccountDataSource.DataSet := AccountQuery;
OpportunityDataSource.DataSet := OpportunityQuery;
OpportunityQuery.MasterSource := AccountDataSource;

7. Open the Queries

Open the queries to obtain the required result:

AccountQuery.Open;
OpportunityQuery.Open;

8. See the Results

In the screenshot below, you can see the obtained work result.

We were able to implement the specified task. We have seen that working with cloud CRM data in Delphi is as simple as using traditional DBs. Similarly, you can work with data of any system with the necessary driver. Devart offers a whole range of such ODBC drivers. This list is constantly updated, allowing end users opportunities to work with a variety of data.

Customer relationship management Delphi (programming language) Database Driver (software) app Integration

Published at DZone with permission of Jordan Sanders. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Is xAPI: All You Need to Know to Get Started
  • The Developer's Guide to SaaS Compliance
  • Edge Computing: Implementation, Advantages, and Disadvantages
  • JVM C1, C2 Compiler Thread: High CPU Consumption?

Comments

Integration Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo