Nav

Salesforce Analytics Cloud Connector

The Anypoint Connector for Salesforce Analytics Cloud lets you connect to the Salesforce Analytics Cloud application using the Salesforce External Data API. The connector exposes convenient methods for creating, deleting and populating data sets into Salesforce Analytics Cloud system. Load data into Analytics Cloud from many different data sources whether they are on-premise or on the cloud. Go beyond .csv files with this connector.

Prerequisites

This document assumes that you are familiar with Mule, Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and Global Elements.

You need login credentials to test your connection to your target resource.

For hardware and software requirements and compatibility information, see the Connector Release Notes.

To use this connector with Maven, view the pom.xml dependency information in the Dependency Snippets in Anypoint Exchange.

What’s New in this Connector

This connector is the first release for Mule 4.

Connect in Design Center

  1. In Design Center, click Set Up > Upload, browse for and select the driver for this connector on your file system, and upload it. Alternatively, search for and select a driver that is already uploaded.

  2. Click a trigger. You can create a global element by selecting this connector as they trigger. If a global element is not needed, you can use an HTTP Listener or Scheduler trigger.

  3. To create an optional global element for the connector, you can choose from the following options. More information is provided in the sections that follow, and links to Salesforce documents are listed in the See Also section of this document.

    • Required Parameters for Basic Username Password Authentication

    • Required Parameters for the OAuth 2.0 Configuration

    • Required Parameters for the OAuth 2.0 JWT Bearer Configuration

    • Required Parameters for the OAuth 2.0 SAML Bearer Configuration

      Choose Global Type

  4. Select the plus sign to add a component.

  5. Select the connector as a component.

  6. Configure these fields for Upload external data into new dataSet and start processing operation:

    • Type - Type of the records to be inserted. You need to upload a JSON file representing the schema of the dataset to be created.

    • Records - Data sense expression; the records to be inserted

    • Operation - Which operation to use when you’re loading data into the DataSet

    • Description

    • Label

    • Data Set Name

      Upload and start processing

Required Parameters for Basic Username Password Authentication

  • Username: Enter the Salesforce Analytics username.

  • Password: Enter the corresponding password.

  • Security Token: Enter the corresponding security token.

Basic Authentication

Required Parameters for the OAuth 2.0 Configuration

  • Consumer Key - The consumer key for the Salesforce connected app.

  • Consumer Secret - The consumer secret for the connector to access Salesforce.

OAuth Authentication

Required Parameters for the OAuth 2.0 JWT Bearer Configuration

  • Consumer Key - The consumer key for the Salesforce connected app.

  • Keystore File - See Generating a Keystore File.

  • Store Password - The password for the keystore.

  • Principal - The Salesforce username that you want to use.

JWT Bearer Configuration

Required Parameters for the OAuth 2.0 SAML Bearer Configuration

  • Consumer Key - The consumer key for the Salesforce connected app.

  • Keystore File - The path to the key store used to sign data during authentication* Only Java key store format is allowed.

  • Store Password - Key store password

  • Principal - Username of desired Salesforce user

SAML Bearer Configuration

Generating a Keystore File

The Keystore is the path to the keystore used to sign data during authentication. Only Java keystore format is allowed.

To generate a keystore file:

  1. Go to your Mule workspace, and open the command prompt (for Windows) or Terminal (for Mac). 

  2. Type keytool -genkeypair -alias salesforce-cert -keyalg RSA -keystore salesforce-cert.jks and press enter.  

  3. Enter the following details:

    • Password for the keystore. 

    • Your first name and last name. 

    • Your organization unit. 

    • Name of your city, state, and the two letter code of your county.

      The system generates a java keystore file containing a private/public key pair in your workspace.

  4. Provide the file path for the Keystore in your connector configuration.

    Type keytool -exportcert -alias salesforce-cert -file salesforce-cert.crt -keystore salesforce-cert.jks and press enter.

    The system now exports the public key from the keystore into the workspace. This is the public key that you need to enter in your Salesforce instance.

  5. Make sure that you have both the keystore (salesforce-cert.jks) and the public key (salesforce-cert.crt) files in your workspace.

Connect in Anypoint Studio 7

You can use this connector in Anypoint Studio by first downloading it from Exchange and configuring it as needed.

Install Connector in Studio

  1. Click Add Module and search for this connector.

  2. Click Add and Finish.

Configure in Studio

  1. Drag and drop the connector to the Studio canvas.

  2. To create a global element for the connector, set these fields:

    • Basic Authentication:

      • Username: Enter the Salesforce username.

      • Password: Enter the corresponding password.

      • Security Token: Enter the corresponding security token.

        Basic Authentication

    • OAuth 2.0:

      • Consumer Key - The consumer key for the Salesforce connected app.

      • Consumer Secret - The consumer secret for the connector to access Salesforce.

        OAuth Authentication

    • OAuth 2.0 JWT:

      • Consumer Key - The consumer key for the Salesforce connected app.

      • Keystore File - See Generating a Keystore File.

      • Store Password - The password for the keystore.

      • Principal - The password for the keystore.

        OAuth 2.0 JWT Authentication

    • OAuth 2.0 SAML:

      • Consumer Key - The consumer key for the Salesforce connected app.

      • Keystore File - See Generating a Keystore File.

      • Store Password - The password for the keystore.

      • Principal - The password for the keystore.

        OAuth 2.0 SAML Authentication

  3. Configure these fields for upload external data into new dataSet and start processing operation:

    • Type - Type of the records to insert. Select a JSON file representing the schema of the dataset to be created.

    • Records - DataSense expression - the records to be inserted.

    • Operation - Which operation to use when you’re loading data into a data set.

    • Description

    • Label

    • Data Set Name

      Upload external data

Use Case: Studio

This use case provides an example of how to use the Salesforce Analytics Connector and contains this end to end flow:

  • A trigger represented by the HTTP listener.

  • A Salesforce Analytics configuration containing a username, password, and the security token.

  • A Salesforce Analytics operation with the parameters to use.

The example that follows contains these components:

  • HTTP Listener - Accepts data from http requests.

  • Transform Message - Provides the records input data required by Salesforce analytics connector.


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%dw 2.0
---
output application/java
[
        {
                "Id": 1,
                "Country": "Country",
                "City": "City",
                "Year": 428742153,
                "Distance": 284644936,
                "Currencies":
                [
                        "EUR",
                        "USD"
                ],
                "CreationDate": "20/12/2017" as Date {format: "dd/MM/yyyy"}
        },
        {
                "Id": 2,
                "Country": "Country",
                "City": "City",
                "Year": 1432651434,
                "Distance": 1336594394,
                "Currencies":
                [
                        "EUR",
                        "USD",
                        "HUF"
                ],
                "CreationDate": "20/12/2017" as Date {format: "dd/MM/yyyy"}
        }
]
  • Salesforce Analytics connector - Connects with Salesforce, and performs an operation to push data into Salesforce Analytics.

Use case

Use Case: XML

Paste this XML code into Anypoint Studio to experiment with the flow described in the previous section. Keep in mind that you still have to provide the metadata.json file describing the schema of the dataset to be created.


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:salesforce-analytics="http://www.mulesoft.org/schema/mule/salesforce-analytics"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file
http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/salesforce-analytics
http://www.mulesoft.org/schema/mule/salesforce-analytics/current/mule-salesforce-analytics.xsd">
         <configuration-properties file="mule-app.properties" />
        <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" >
                <http:listener-connection host="0.0.0.0" port="8081" />
        </http:listener-config>
        <salesforce-analytics:salesforce-analytics-config
          name="Salesforce_Analytics_Salesforce_Analytics"
          doc:name="Salesforce Analytics Salesforce Analytics" >
                <salesforce-analytics:basic-connection username="${salesforce.username}"
                   password="${salesforce.password}" securityToken="${salesforce.securityToken}"
                   url="${salesforce.url}"/>
        </salesforce-analytics:salesforce-analytics-config>
        <flow name="upload-all-in-one-with-append" >
                <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="append"/>
                <ee:transform doc:name="Transform Message" >
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
[
        {
                "Id": 1,
                "Country": "Country",
                "City": "City",
                "Year": 428742153,
                "Distance": 284644936,
                "Currencies":
                [
                        "EUR",
                        "USD"
                ],
                "CreationDate": "20/12/2017" as Date {format: "dd/MM/yyyy"}
        },
        {
                "Id": 2,
                "Country": "Country",
                "City": "City",
                "Year": 1432651434,
                "Distance": 1336594394,
                "Currencies":
                [
                        "EUR",
                        "USD",
                        "HUF"
                ],
                "CreationDate": "20/12/2017" as Date {format: "dd/MM/yyyy"}
        }
]]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <salesforce-analytics:upload-external-data-into-new-data-set-and-start-processing
                  doc:name="Upload external data into new data set and start processing"
                  config-ref="Salesforce_Analytics_Salesforce_Analytics" operation="APPEND"
                  description="${allInOne.dataSetDescription}" label="${allInOne.dataSetLabel}"
                  dataSetName="${allInOne.dataSetName}" edgemartContainer="${allInOne.dataSetContainerName}"
                  type="metadata.json" notificationSent="ALWAYS" notificationEmail="${notification.email}"/>
        </flow>
</mule>

See Also