![]() |
VOOZH | about |
Adobe ColdFusion is a web and mobile application development platform. It uses its own scripting language, ColdFusion Markup Language (CFML), to create data-driven websites as well as generate remote services, such as REST. When ColdFusion is paired with the CData ODBC Driver for Salesforce, you can link your ColdFusion web and mobile applications to operational Salesforce data. This allows for your applications to be more robust and complete. This article details how to use the ODBC driver to create a table populated with Salesforce data from within a ColdFusion markup file.
Accessing and integrating live data from Salesforce has never been easier with CData. Customers rely on CData connectivity to:
Users frequently integrate Salesforce data with:
For more information on how CData solutions work with Salesforce, check out our Salesforce integration page.
To follow along with this tutorial, you need to install the CData ODBC Driver for Salesforce and Adobe ColdFusion.
If you have not already, first specify connection properties in an ODBC DSN (Data Source Name). This is the last step of the driver installation process. You can use the Microsoft ODBC Data Source Administrator to create and configure ODBC DSNs.
There are several authentication methods available for connecting to Salesforce: OAuth, Login (or basic), and SSO. The Login method requires you to have the username, password, and security token of the user.
The default authentication mechanism (and the one preferred by Salesforce) is OAuth. To use OAuth with CData's embedded OAuth application, leave the connection properties blank. If you have configured your own custom OAuth application with Salesforce (see the Help documentation for more information), set OAuthClientId, OAuthClientSecret, and CallbackURL to the properties for you application. Set InitiateOAuth to the desired OAuth flow ("GETANDREFRESH" will have the connector manage the entire OAuth flow).
If you do not wish do not wish to use OAuth authentication, you can use Login (or basic) authentication. Set AuthScheme to Basic, and set the User, Password, and SecurityToken properties. You can configure your security token in Salesforce.
SSO (single sign-on) can be used by setting the SSOProperties, SSOLoginUrl, and SSOExchangeURL connection properties, which allow you to authenticate to an identity provider. See the "Getting Started" chapter in the Help documentation for more information.
If your Salesforce org has MFA enforcement enabled, set MFACode to the time-based one-time passcode (TOTP) generated by your authenticator app (such as Salesforce Authenticator or Google Authenticator). MFACode applies to both OAuth and Login authentication flows.
After creating a DSN, follow the steps below to add a new data source, test our connection to it, create a ColdFusion markup file, and, finally, import Salesforce Data and display it in a table in ColdFusion:
The following code queries the data source:
<cfquery name="SalesforceQuery" dataSource="CDataSalesforceODBC"> SELECT * FROM Account </cfquery>And a CFTable can be used to quickly output the table in HTML:
<cftable query = "SalesforceQuery" border = "1" colHeaders colSpacing = "2" headerLines = "2" HTMLTable maxRows = "500" startRow = "1"> <cfcol header="<b>Industry</b>" align="Left" width=2 text="Industry"/> <cfcol header="<b>AnnualRevenue</b>" align="Left" width=15 text="AnnualRevenue"/> ... </cftable>Full code, including the HTML portion is available below:
<html>
<head><title>CData Software | Salesforce Account Table Demo </title></head>
<body>
<cfoutput>#ucase("Salesforce Account Table Demo")#</cfoutput>
<cfquery name="SalesforceQuery" dataSource="CDataSalesforceODBC">
SELECT * FROM Account
</cfquery>
<cftable
query = "SalesforceQuery"
border = "1"
colHeaders
colSpacing = "2"
headerLines = "2"
HTMLTable
maxRows = "500"
startRow = "1">
<cfcol header="<b>Industry</b>" align="Left" width=2 text="Industry"/>
<cfcol header="<b>AnnualRevenue</b>" align="Left" width=15 text="AnnualRevenue"/>
...
</cftable>
</body>
</html>
As a note, the CData ODBC Drivers also support parameterized queries using the cfqueryparam element. For example:
SELECT * FROM Account WHERE name =
Download a free, 30-day trial of the CData ODBC Driver for Salesforce and start building Salesforce-connected applications with Adobe ColdFusion. Reach out to our Support Team if you have any questions.
Download a free trial of the Salesforce ODBC Driver to get started:
Download NowLearn more:
๐ Salesforce IconThe Salesforce ODBC Driver is a powerful tool that allows you to connect with live Salesforce account data, directly from any applications that support ODBC connectivity.
Access Salesforce data like you would a database - read, write, and update Leads, Contacts, Opportunities, Accounts, etc. through a standard ODBC Driver interface.