With Flint's Salesforce Connector you can perform create, delete, list, update and many other operations for Case and User

With this document, we will be able to use and work with the Salesforce Connector.

Design Aspects

Perform all standard application operations like Create, Update, Delete, Get and List operations available through the Salesforce connector.

Some of them are listed below:

Case

  • Add
  • List
  • Get
  • Update
  • Delete 

User

  • Add
  • List
  • Get
  • Update
  • Delete

Configuring Salesforce connector

Configuration parameters
ParameterDescriptionRequired
usernameUsername associated with your Salesforce account.true
passwordPassword id associated with your Salesforce account.true
hostnameOwn unique identifier or URI. If you want to access data you need this unique identifier or URI.true
client_idId associated with Client.true
client_secretSecret key of Clienttrue
Example
{
  "client_id": "XYZ",
  "client_secret": "571220113612345",
  "hostname": "my.salesforce.com",
  "password": "Flint@123",
  "username": "flint@infiverve.com"
}

Actions

create-record

To create/insert new record in Salesforce.

Request parameters
ParameterDescriptionRequired
connector_nameName of connector i.e Salesforcetrue
actioncreate-recordtrue
sobjectTo perform provided action on i.e for Case or for Usertrue
datadata is a inner json, whatever u provide in data as key:value pair is accepted if validtrue
Response parameters
ParameterDescriptionRequired
bodyResponse Body i.e Info get in response on performing some actiontrue
Example

For Case

 Data should be provided like :-

  data = {}
  data['Description']= "New Case Creation"
  data['Origin']= 'Phone'
  data['Priority']= 'High'
  data['Status']= 'On Hold'

          response = @call.connector(@connector_name)
                          .set('action', 'create-case')
                          .set('sobject', 'Case')
                          .set('data', data)
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('body')            # Response body

For User

 

 Data should be provided like :-

    data = {}
    data["Username"] = "sbrad22ley@gmail.com",
    data["LastName"] = "Bradle2y",
    data["FirstName"] = "Sam",
    data["Email"] = "samule222@gmail.com",
    data["Alias"] = "bradley",
    data["CommunityNickname"] = "sbradleyyourorgdmain",
    data["IsActive"] = false,
    data["TimeZoneSidKey"] = "America/Los_Angeles",
    data["LocaleSidKey"] = "en_US",
    data["EmailEncodingKey"] = "ISO-8859-1",
    data["ProfileId"] = "00e36000000N1y2AAC",
    data["LanguageLocaleKey"] = "en_US",
    data["UserPermissionsMobileUser"] = false,
    data["UserPreferencesDisableAutoSubForFeeds"] = false

response = @call.connector(@connector_name)
                          .set('action', 'create-user')
                          .set('sobject', 'User')
                          .set('data', @data)
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('body')            # Response body

 

list-record

To get detailed list of all the record in Salesforce.

Request parameters
 ParameterDescriptionRequired
connector_nameName of connector i.e Salesforcetrue
actionlist-recordtrue
sobjectTo perform provided action on i.e for Case or for Usertrue
Response parameters
 ParameterDescriptionRequired
bodyResponse Body i.e Info get in response on performing some actiontrue
Example

For Case

  response = @call.connector(@connector_name)
                          .set('action', 'list-record')
                          .set('sobject', 'Case')
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('body')            # Response body

For User

 response = @call.connector(@connector_name)
                          .set('action', 'list-record')
                          .set('sobject', 'User')
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('body')            # Response body


get-record

To get detail of the selected record in Salesforce.

Request parameters
 ParameterDescriptionRequired
connector_nameName of connector i.e Salesforcetrue
actionlist-recordtrue
sobjectTo perform provided action on i.e for Case or for Usertrue
idId of the User or Casetrue
Response parameters
 ParameterDescriptionRequired
bodyResponse Body i.e Info get in response on performing some actiontrue
Example

For Case

response = @call.connector(@connector_name)
                          .set('action', 'get-record')
                          .set('sobject', 'Case')
                          .set('id', '00536000000KhEsAAK')
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('result')            # Response body

For User

response = @call.connector(@connector_name)
                          .set('action', 'get-record')
                          .set('sobject', 'User')
                          .set('id', '00536000000KhEsAAK')
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('result')            # Response body


update-record

To update the selected record in Salesforce.

Request parameters
 ParameterDescriptionRequired
connector_nameName of connector i.e Salesforcetrue
actionupdate-recordtrue
sobjectTo perform provided action on i.e for Case or for Usertrue
idId of the User or Casetrue
data

data is a inner json, whatever u provide inside data{ } as

key:value pair is accepted if valid

true
Response parameters
Parameter DescriptionRequired
bodyResponse Body i.e Info get in response on performing some actiontrue
Example

For Case

  response = @call.connector(@connector_name)
                          .set('action', 'update-record')
                          .set('sobject', 'Case')
                          .set('id', '00536000000KhEsAAK')
                          .set('data', @data)
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('result')            # Response body

For User

 response = @call.connector(@connector_name)
                          .set('action', 'update-record')
                          .set('sobject', 'User')
                          .set('id', '00536000000KhEsAAK')
                          .set('data', @data)
                          .sync

    # Salesfoce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesfoce Connector Response Parameters
    response_body = response.get('result')            # Response body


delete-record

To Delete the selected record from Salesforce.

Request parameters
 ParameterDescriptionRequired
connector_nameName of connector i.e Salesforcetrue
actiondelete-recordtrue
sobjectTo perform provided action on i.e for Case or for Usertrue
idId of the User or Casetrue
Response parameters
Parameter DescriptionRequired
bodyResponse Body i.e Info get in response on performing some actiontrue
Example

For Case

  response = @call.connector(@connector_name)
                          .set('action', 'delete-record')
                          .set('sobject', 'Case')
                          .set('id', '00536000000KhEsAAK')
                          .sync

    # Salesforce Connector Response Meta Parameters
    response_exitcode = response.exitcode           # Exit status code
    response_message = response.message             # Execution status message

    # Salesforce Connector Response Parameters
    response_body = response.get('result')            # Response body

For User
NOTE : You cannot delete User in SalesForce.

Connector request error handling

Here is how you can handle the connector requests success or failures within your Flintbit. This would help you to take appropriate action if something failed.

 if response.exitcode == 0               # 0 is success.
  @log.info("success")
  # take action in case of success
else                                    # non zero means fail
  @log.error("fail")
  @log.error("Reason:" + response.message)     # get the reason of failure
  ## Take action in case of failure
end

 

 

 


On this page:


  • No labels