Easysoft Blog

Tue, 07 Jun 2016

Working with Salesforce.com Data in SQL Server Reporting Services

The Salesforce.com ODBC Driver enables you to create a Reporting Services project based around Salesforce.com data.

The Salesforce.com ODBC Driver is available to download from the Easysoft web site:

  1. Download the Windows Salesforce.com ODBC Driver. (Registration required.)
  2. Install and license the Salesforce.com ODBC Driver on the machine where SQL Server is installed.

    For installation instructions, see the Salesforce.com ODBC Driver documentation.

Before you can use the Salesforce.com ODBC Driver to connect SQL Server to Salesforce.com, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (e.g. Salesforce.com) and the ODBC driver that is required to connect to it (e.g. the Salesforce.com ODBC driver).

The example report uses a parameterised query so the data in the Salesforce.com result set can be altered by adjusting the parameter values.

  1. In Visual Studio, choose File > New Project.
  2. Choose Templates > Business Intelligence > Reporting Services > Report Server Project.
  3. Choose Project > Add New Item > Dataset.
  4. When prompted to Choose a data source and create a query, choose New.
  5. When prompted to Change name, type and connection options, choose ODBC and then choose Edit to add a Salesforce data source configured in the 32-bit ODBC Administrator (%WINDIR%\SysWOW64\odbcad32.exe), or paste a connection string in the space provided.
    • To create a Salesforce.com ODBC Driver data source:
      1. Do one of the following:
        • To create a User data source, in the User DSN tab, choose Add.

          Important This will only succeed if the SQL Server instance is running under the same user account as the one used to create the data source. Otherwise, you must create a System ODBC data source instead.

          –Or–

        • To create a System data source, choose the System DSN tab, and then choose Add.
      2. In the Create New Data Source dialog box, choose Easysoft ODBC-Salesforce Driver, and then choose Finish.
      3. Complete the Easysoft ODBC-Salesforce Driver DSN Setup dialog box:
        SettingValue
        DSNSalesforce.com
        User NameThe name of your Salesforce.com user. For example, myuser@mydomain.com.
        PasswordThe password for your Salesforce.com user.
        TokenThe security token for your Salesforce.com user, if required.

        To find out whether you need to supply a security token, choose the Test button. If the connection attempt fails with an error which contains LOGIN_MUST_USE_SECURITY_TOKEN, you need to supply one.

        Salesforce.com emails the security token to the email address associated with your Salesforce.com user account. If you have not received a security token, you can regenerate it. Salesforce.com will then email the new security token to you. To regenerate your security token, log in to Salesforce.com and then choose Setup from the user menu. Search for "security token" in the Quick Find box. Click Reset Security Token in the Reset Security Token page. When you receive the token in your email client, copy it and then paste it into the Token field.

      4. Use the Test button to verify that you can successfully connect to Salesforce.com.

    –Or–

    • Enter a connection string in this format:
      DRIVER={Easysoft Salesforce ODBC Driver};UID=myuser@mydomain.com;
      PWD=mypassword;TOKEN=1234ABCD5678FGHI9101112I;
  6. When prompted to Choose a data source and create a query, type the query in the Query box. Use ? instead of named parameters. For example:
    select id, name from quote where createddate = ?
  7. In the left pane, choose Parameters and set appropriate values. For our simple example, I set the Data Type to Date/Time and the Default Value to 2016-02-22 09:44:32.
  8. Choose OK.
  9. In the Solution Explorer, right-click Reports, and then choose Add > New Item.
  10. Choose Report when prompted and then choose Add.
  11. In the Report Data Pane, right-click Datasets, and then choose the newly created Dataset when prompted.
  12. In Design view, populate the report by dragging fields from the left pane to the blank report. In our example, the fields were:
    Datasets > DataSet1 > Id
    Datasets > DataSet1 > Name
  13. Choose Preview to view the data.