ballerinax/salesforce Ballerina library

7.5.1

Overview

Salesforce REST API provides CRUD operations for SObjects, query using SOQL, search using SOSL, and describe SObjects and organizational data.

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:

Step 1: Import connector

Import the ballerinax/salesforce module into the Ballerina project.

Copy
import ballerinax/salesforce;

Step 2: Create a new connector instance

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

Copy
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
configurable string refreshUrl = ?;
configurable string baseUrl = ?;

salesforce:ConnectionConfig sfConfig = {
    baseUrl: baseUrl,
    auth: {
        clientId: clientId,
        clientSecret: clientSecret,
        refreshToken: refreshToken,
        refreshUrl: refreshUrl
    }
};

salesforce:Client baseClient = new(sfConfig);

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
record{} accountRecord = {
    "Name": "IT World",
    "BillingCity": "Colombo 1"
};

public function main() returns error? {
  salesforce:CreationResponse res = check baseClient->create("Account", accountRecord);
}
  1. Use bal run command to compile and run the Ballerina program.

You can find a list of samples here

Import

import ballerinax/salesforce;Copy

Metadata

Released date: 8 months ago

Version: 7.5.1

License: Apache-2.0


Compatibility

Platform: java11

Ballerina version: 2201.7.0

GraalVM compatible: Yes


Pull count

Total: 94171

Current verison: 166


Weekly downloads


Source repository


Keywords

Sales & CRM/Customer Relationship Management

Cost/Freemium


Contributors

Other versions

See more...