ballerinax/sfdc

3.0.1

Overview

The Salesforce connector allows users to perform CRUD operations for SObjects, query using SOQL, search using SOSL, and describe SObjects and organizational data through the Salesforce REST API. Apart from these functionalities, Ballerina Salesforce Connector includes a listener to capture events.

This module supports Salesforce v48.0 REST API.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

  1. Create Salesforce account
  2. Obtain tokens

Quickstart

To use the Salesforce connector in your Ballerina application, update the .bal file as follows:

Client

Step 1: Import connector

Import the ballerinax/sfdc module into the Ballerina project.

Copy

Step 2: Create a new connector instance

Create a sfdc:ConnectionConfig with the OAuth2 tokens obtained, and initialize the connector with it.

Copy

Step 3: Invoke connector operation

  1. Now you can use the operations available within the connector. Note that they are in the form of remote operations.
    Following is an example on how to create a record using the connector.

    Copy
  2. Use bal run command to compile and run the Ballerina program.

Listener

Step 1: Import connector

Import the ballerinax/sfdc module into the Ballerina project.

Copy

Step 2: Create a new connector listener instance

Create a sfdc:ListenerConfiguration with the basic credentials obtained, and initialize the connector with it. The password should be the concatenation of the user's Salesforce password and secret key.

Copy

Step 3: Invoke listener service

  1. Now you can use the channel available in the Salesforce and capture the events occurred.
    Following is an example on how to capture all events using the connector.

    Copy
  2. Use bal run command to compile and run the Ballerina program.

You can find a list of samples here

Other versions

See more...