May 6, 2020

Salesforce Analytics Cloud Connector - Mule 4

Anypoint Connector for Salesforce Analytics Cloud (Salesforce Analytics Connector) enables you to 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

To use this information, you should be familiar with Salesforce Analytics, 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.

POM File Information

<dependency>

<groupId>

com.mulesoft.connectors

</groupId>

<artifactId>

mule-sfdc-analytics-connector

</artifactId>

<version>

RELEASE

</version>

<classifier>

mule-plugin

</classifier>

</dependency>

Mule converts RELEASE to the latest version.

To specify a version, view Salesforce Einstein Analytics Connector in Anypoint Exchange and click Dependency Snippets. For more info Mulesoft Training

Connect in Design Center

  1. In Design Center, click a trigger such as this connector as they trigger, HTTP Listener,or Scheduler trigger.
  2. 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
  3. Select the plus sign to add a component.
  4. Select the connector as a component.
  5. 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

Required Parameters for Basic Username Password Authentication

  • Username: Enter the Salesforce Analytics username.
  • Password: Enter the corresponding password.

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.

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.

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

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.

Add the Connector to a Studio Project

Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette view.

Add the Connector Using Exchange

  1. In Studio, create a Mule project.
  2. Click the Exchange icon (X) in the upper-left of the Studio task bar.
  3. In Exchange, click Login and supply your Anypoint Platform username and password.
  4. In Exchange, search for "analytics".
  5. Select the connector and click Add to project.
  6. Follow the prompts to install the connector.

Add the Connector in Studio

  1. In Studio, create a Mule project.
  2. In the Mule Palette view, click (X) Search in Exchange.
  3. In Add Modules to Project, type "analytics" in the search field.
  4. Click this connector’s name in Available modules.
  5. Click Add.
  6. Click Finish.

Configure in Studio

  1. Drag 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.
    • 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 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 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.
  3. Configure these fields for upload external data into new dataSet and start processing operation:
To get in-depth knowledge, enroll for a live free demo on Mulesoft Online Training
    • 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