Skip to content

SalesforceBulk Connector Reference

The following operations allow you to work with the Salesforce SOAP Connector. Click an operation name to see parameter details and samples on how to use it.


Initialize the connector

To use the Salesforce SOAP connector, add the <salesforcerest.init> element in your configuration before carrying out any other Salesforce SOAP operations.

salesforcebulk.init

The salesforcerest.init operation initializes the connector to interact with the Salesforce SOAP API. See the related API documentation for more information.

Parameter Name Description Required
username The username to access the Salesforce account. Yes
password The password provided here is a concatenation of the user password and the security token provided by Salesforce. Yes
loginUrl The login URL to access the Salesforce account. Yes
blocking Indicates whether the connector needs to perform blocking invocations to Salesforce. (Supported in WSO2 ESB 4.9.0 and later.) Yes

Sample configuration

<salesforce.init>
    <loginUrl>{$ctx:loginUrl}</loginUrl>
    <username>{$ctx:username}</username>
    <password>{$ctx:password}</password>
    <blocking>{$ctx:blocking}</blocking>
 </salesforce.init>

Sample request

<salesforce.init>
    <username>MyUsername</username>
    <password>MyPassword</password>
    <loginUrl>https://login.salesforce.com/services/Soap/u/42.0</loginUrl>
    <blocking>false</blocking>
</salesforce.init>

Working with emails

emails

The salesforcebulk.emails method creates and sends an email using Salesforce based on the properties that you specify. See the related API documentation for more information.

Parameter Name Description Required
sendEmail XML representation of the email. Yes

Sample configuration

<salesforce.sendEmail>
    <sendEmail xmlns:sfdc="sfdc">{//sfdc:emailWrapper}</sendEmail>
</salesforce.sendEmail>

Sample request

Given below is a sample request that can be handled by the sendEmail operation.

<payloadFactory>
   <format>
     <sfdc:emailWrapper xmlns:sfdc="sfdc">
     <sfdc:messages type="urn:SingleEmailMessage">
        <sfdc:bccSender>true</sfdc:bccSender>
        <sfdc:emailPriority>High</sfdc:emailPriority>
        <sfdc:replyTo>123@gmail.com</sfdc:replyTo>
        <sfdc:saveAsActivity>false</sfdc:saveAsActivity>
        <sfdc:senderDisplayName>wso2</sfdc:senderDisplayName>
        <sfdc:subject>test</sfdc:subject>
        <sfdc:useSignature>false</sfdc:useSignature>
       <sfdc:targetObjectId>00390000001PBFn</sfdc:targetObjectId>
       <sfdc:plainTextBody>Hello, this is a holiday greeting!</sfdc:plainTextBody>    
     </sfdc:messages>
      </sfdc:emailWrapper>
    </format>
    <args/>
</payloadFactory>

<salesforce.sendEmail>
    <sendEmail xmlns:sfdc="sfdc">{//sfdc:emailWrapper}</sendEmail>
</salesforce.sendEmail>
sendEmailMessage

The salesforcebulk.sendEmailMessage method sends emails that have already been drafted in Salesforce. See the related API documentation for more information.

Parameter Name Description Required
sendEmailMessage XML representation of the email IDs to send. Yes

Sample configuration

<salesforce.sendEmailMessage config-ref="connectorConfig">
    <sendEmailMessage xmlns:sfdc="sfdc">{//sfdc:emails}</sendEmailMessage>
</salesforce.sendEmailMessage>

Sample request

Given below is a sample request that can be handled by the sendEmailMessage operation.

<payloadFactory>
    <format>
        <sfdc:emails xmlns:sfdc="sfdc">
            <sfdc:Ids>0019000000aaMkK</sfdc:Ids>
            <sfdc:Ids>0019000000bbMkK</sfdc:Ids>
        </sfdc:emails>
    </format>
    <args/>
</payloadFactory>

<salesforce.sendEmailMessage config-ref="connectorConfig">
    <sendEmailMessage xmlns:sfdc="sfdc">{//sfdc:emails}</sendEmailMessage>
</salesforce.sendEmailMessage>

Working with records

salesforcebulk.create

The salesforcerest.create operation creates one or more record with the Salesforce SOAP API. See the related API documentation for more information.

Parameter Name Description Required
allOrNone Whether to rollback changes if an object fails (see Common Parameters). Yes
allowFieldTruncate Whether to truncate strings that exceed the field length (see Common Parameters). Yes
sobjects XML representation of the records to add. Yes

Sample configuration

<salesforce.create configKey="MySFConfig">
    <allOrNone>0</allOrNone>
    <allowFieldTruncate>0</allowFieldTruncate>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.create>

Sample request

Given below is a sample request that can be handled by the create operation.

salesforcebulk.update

The salesforcerest.update operation updates one or more existing records with the Salesforce SOAP API. See the related API documentation for more information.

Parameter Name Description Required
allOrNone Whether to rollback changes if an object fails (see Common Parameters). Yes
allowFieldTruncate Whether to truncate strings that exceed the field length (see Common Parameters). Yes
sobjects XML representation of the records to add. Yes

Sample configuration

<salesforce.update configKey="MySFConfig">
    <allOrNone>0</allOrNone>
    <allowFieldTruncate>0</allowFieldTruncate>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.update>

Sample request

Given below is a sample request that can be handled by the create operation.

salesforcebulk.upsert

The salesforcerest.upsert operation update existing records and insert new records in a single operation, with the Salesforce SOAP API. See the related API documentation for more information.

Parameter Name Description Required
allOrNone Whether to rollback changes if an object fails (see Common Parameters). Yes
allowFieldTruncate Whether to truncate strings that exceed the field length (see Common Parameters). Yes
externalId The field containing the record ID, that is used by Salesforce to determine whether to update an existing record or create a new one. This is done by matching the ID to the record IDs in Salesforce. By default, the field is assumed to be named "Id". Yes
sObjects XML representation of the records to update and insert. When inserting a new record, you do not specify sfdc:Id. Yes

Sample configuration

<salesforce.upsert configKey="MySFConfig">
    <allOrNone>0</allOrNone>
    <allowFieldTruncate>0</allowFieldTruncate>
    <externalId>Id</externalId>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.upsert>
Sample request

Set the externalId field : If you need to give any existing externalId field of sObject to externalId then the payload should be with that externalId field and value as follows in sample.

Sample to set ExternalId field and value

<payloadFactory>
    <format>
        <sfdc:sObjects xmlns:sfdc="sfdc" type="Account">
          <sfdc:sObject>
             <sfdc:sample__c>{any value}</sfdc:sample__c>
             <sfdc:Name>newname001</sfdc:Name>
          </sfdc:sObject>
       </sfdc:sObjects>
    </format>
    <args/>
</payloadFactory>

<salesforce.upsert>
    <allOrNone>0</allOrNone>
    <allowFieldTruncate>0</allowFieldTruncate>
    <externalId>sample__c</externalId>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.upsert>
Given below is a sample request that can be handled by the create operation.

salesforcebulk.search

The salesforcerest.search operation searchs for records, use salesforce.search and specify the search string. If you already know the record IDs, use retrieve instead. See the related API documentation for more information.

Parameter Name Description Required
searchString The SQL query to use to search for records. Yes

Sample configuration

salesforcebulk.query

The salesforcerest.query operation retrieve data from an object, use salesforce.query with the Salesforce SOAP API. See the related API documentation for more information.

Parameter Name Description Required
batchSize The number of records to return. If more records are available than the batch size, you can use the queryMore operation to get additional results. Yes
queryString The SQL query to use to search for records. Yes

Sample configuration

Note : If you want your search results to include deleted records that are available in the Recycle Bin, use salesforce.queryAll in place of salesforce.query.

<salesforce.query configKey="MySFConfig">
    <batchSize>200</batchSize>
    <queryString>select id,name from Account</queryString>
</salesforce.query>

Sample request

Following is a sample configuration to query records. It also illustrates the use of queryMore operation to get additional results:

salesforcebulk.retrieve

The salesforcerest.retrieve operation IDs of the records you want to retrieve with the Salesforce SOAP API. If you do not know the record IDs, use query instead. See the related API documentation for more information.

Parameter Name Description Required
fieldList A comma-separated list of the fields you want to retrieve from the records. Yes
objectType The object type of the records. Yes
sobjects XML representation of the records to retrieve. Yes

Sample configuration

<salesforce.retrieve configKey="MySFConfig">
    <fieldList>id,name</fieldList>
    <objectType>Account</objectType>
    <objectIDS xmlns:sfdc="sfdc">{//sfdc:sObjects}</objectIDS>
</salesforce.retrieve>

Sample request

Given below is a sample request that can be handled by the retrieve operation.

salesforcebulk.delete

The salesforcerest.delete operation delete one or more records. If you do not know the record IDs, use query instead. See the related API documentation for more information.

Parameter Name Description Required
allOrNone Whether to rollback changes if an object fails (see Common Parameters). Yes
sobjects XML representation of the records to delete, as shown in the following example. Yes

Sample configuration

<salesforce.delete configKey="MySFConfig">
   <allOrNone>0</allOrNone>
   <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.delete>

Sample request

Given below is a sample request that can be handled by the retrieve operation.

salesforcebulk.undelete

The salesforcerest.undelete operation restore records that were previously deleted. See the related API documentation for more information.

Parameter Name Description Required
allOrNone Whether to rollback changes if an object fails (see Common Parameters). Yes
sobjects XML representation of the records to delete, as shown in the following example. Yes

Sample configuration

<salesforce.undelete configKey="MySFConfig">
    <allOrNone>0</allOrNone>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.undelete>

Sample request

Given below is a sample request that can be handled by the undelete operation.

salesforcebulk.getDeleted

The salesforcerest.getDeleted operation retrieve the list of records that were previously deleted. See the related API documentation for more information.

Parameter Name Description Required
sObjectType sObjectType from which we need to retrieve deleted records Yes
startDate start date and time for deleted records lookup Yes
endDate end date and time for deleted records lookup Yes

Sample configuration

<salesforce.getDeleted configKey="MySFConfig">
    <sObjectType>{$ctx:sObjectType}</sObjectType>
    <startDate>{$ctx:startDate}</startDate>
    <endDate>{$ctx:endDate}</endDate>
</salesforce.getDeleted>

Sample request

Given below is a sample request that can be handled by the getDeleted operation.

salesforcebulk.getUpdated

The salesforcerest.getUpdated operation retrieve the list of records that were previously updated. See the related API documentation for more information.

Parameter Name Description Required
sObjectType sObjectType from which we need to retrieve deleted records Yes
startDate start date and time for deleted records lookup Yes
endDate end date and time for deleted records lookup Yes

Sample configuration

<salesforce.getUpdated configKey="MySFConfig">
    <sObjectType>{$ctx:sObjectType}</sObjectType>
    <startDate>{$ctx:startDate}</startDate>
    <endDate>{$ctx:endDate}</endDate>
</salesforce.getUpdated>

Sample request

Given below is a sample request that can be handled by the getUpdated operation.

salesforcebulk.findDuplicates

The salesforcerest.findDuplicates operation retrieve the list of records that are duplicate entries. See the related API documentation for more information.

Parameter Name Description Required
sobjects sObjectType from which we need to retrieve duplicate records Yes

Sample configuration

<salesforce.findDuplicates configKey="MySFConfig">
    <sobjects xmlns:ns="wso2.connector.salesforce">{//ns:sObjects}</sobjects>
</salesforce.findDuplicates>

Sample request

Given below is a sample request that can be handled by the findDuplicates operation.

salesforcebulk.findDuplicatesByIds

The salesforcerest.findDuplicatesByIds operation retrieves the list of records that are duplicate entries by using ids. See the related API documentation for more information.

Parameter Name Description Required
ids ids for which duplicate records need to be found Yes

Sample configuration

<salesforce.findDuplicatesByIds configKey="MySFConfig">
    <ids xmlns:ns="wso2.connector.salesforce">{//ns:ids}</ids>
</salesforce.findDuplicatesByIds>

Sample request

Given below is a sample request that can be handled by the findDuplicatesByIds operation.

salesforcebulk.merge

The salesforcerest.merge operation merge records into one master record. See the related API documentation for more information.

Parameter Name Description Required
mergerequests The merge requests according to the format defined in to Salesforce docs (See Related Salesforce documentation section) Yes

Sample configuration

<salesforce.merge configKey="MySFConfig">
    <mergerequests xmlns:ns="wso2.connector.salesforce">{//ns:requests}</mergerequests>
</salesforce.merge>

Sample request

Given below is a sample request that can be handled by the merge operation.

salesforcebulk.convertLead

The salesforcerest.convertLead operation convert a lead into an account. See the related API documentation for more information.

Parameter Name Description Required
leadconvertrequests The lead convert requests according to the format defined in to Salesforce docs (See Related Salesforce documentation section) Yes

Sample configuration

<salesforce.convertLead configKey="MySFConfig">
     <leadconvertrequests xmlns:ns="wso2.connector.salesforce">{//ns:leadconvertrequests}</leadconvertrequests>
</salesforce.convertLead>

Sample request

Given below is a sample request that can be handled by the merge operation.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:urn="wso2.connector.salesforce">
    <soapenv:Header/>
    <soapenv:Body>
        <urn:loginUrl>https://login.salesforce.com/services/Soap/u/48.0</urn:loginUrl>
        <urn:username>XXXXXXXXXX</urn:username>
        <urn:password>XXXXXXXXXX</urn:password>
        <urn:blocking>false</urn:blocking>
        <urn:leadconvertrequests>
            <urn:leadConverts>
                <urn:accountId>0012x000005mqKuAAI</urn:accountId>
                <urn:leadId>00Q2x00000AH981EAD</urn:leadId>
                <urn:convertedStatus>Closed - Converted</urn:convertedStatus>
            </urn:leadConverts>
        </urn:leadconvertrequests>
    </soapenv:Body>
</soapenv:Envelope> 

Working with Recycle Bin

salesforcebulk.emptyRecycleBin

The Recycle Bin allows you to view and restore recently deleted records for a maximum of 15 days before they are permanently deleted. To purge records from the Recycle Bin so that they cannot be restored, use salesforce.emptyRecycleBin and specify the following properties. See the related API documentation for more information.

Parameter Name Description Required
allOrNone Whether to rollback changes if an object fails (see Common Parameters). Yes
sobjects XML representation of the records to add. Yes

Sample configuration

<salesforce.emptyRecycleBin config-ref="connectorConfig">
    <allOrNone>0</allOrNone>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.emptyRecycleBin>

Sample request

Given below is a sample request that can be handled by the emptyRecycleBin operation.

<payloadFactory>
   <format>
      <sfdc:sObjects xmlns:sfdc="sfdc">
         <sfdc:Ids>0019000000aaMkZ</sfdc:Ids>
         <sfdc:Ids>0019000000aaMkP</sfdc:Ids>
      </sfdc:sObjects>
   </format>
   <args/>
</payloadFactory>

<salesforce.emptyRecycleBin>
    <allOrNone>0</allOrNone>
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.emptyRecycleBin>

Working with sObjects

salesforcebulk.describeGlobal

The salesforcerest.describeGlobal operation retrieve a list of objects that are available in the system. See the related API documentation for more information.

Sample configuration

salesforcebulk.describeSobject

The salesforcerest.describeSobject operation retrieve metadata (such as name, label, and fields, including the field properties) for a specific object type. See the related API documentation for more information.

Parameter Name Description Required
sobject The object type of where you want to retrieve the metadata. Yes

Sample configuration

salesforcebulk.describeSobjects

The salesforcerest.describeSobjects operation retrieve metadata (such as name, label, and fields, including the field properties) for multiple object types returned as an array. See the related API documentation for more information.

Parameter Name Description Required
sobjects An XML representation of the object types of where you want to retrieve the metadata. Yes

Sample configuration

<salesforce.describeSobjects configKey="MySFConfig">
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.describeSobjects>

Sample request

Given below is a sample request that can be handled by the describeSobjects operation.

<payloadFactory>
    <format>
        <sfdc:sObjects xmlns:sfdc="sfdc">
            <sfdc:sObjectType>Account</sfdc:sObjectType>
            <sfdc:sObjectType>Contact</sfdc:sObjectType>
         </sfdc:sObjects>
     </format>
     <args/>
 </payloadFactory>

<salesforce.describeSobjects configKey="MySFConfig">
    <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects>
</salesforce.describeSobjects> 

Working with User

salesforcebulk.emptyRecycleBin

To retrieve information about the user who is currently logged in, use salesforce.getUserInfo. The information provided includes the name, ID, and contact information of the user. See, the Salesforce documentation for details of the information that is returned using this operation.If you want to get additional information about the user that is not returned by this operation, use retrieve operation on the User object providing the ID returned from getUserInfo. See the related API documentation for more information.

Sample configuration

<salesforce.getUserInfo configKey="MySFConfig"/>
salesforcebulk.setPassword

The salesforcerest.setPassword operation change the user password by specifying the password. See the related API documentation for more information.

Parameter Name Description Required
userId The user's Salesforce ID. Yes
password If using setPassword, the new password to assign to the user. Yes

Sample configuration

setPassword

<salesforce.setPassword configKey="MySFConfig">
    <userId>0056F000009wCJgQAM</userId>
    <password>abc123</password>
</salesforce.setPassword>

resetPassword

<salesforce.resetPassword configKey="MySFConfig">
    <userId>0056F000009wCJgQAM</userId>
</salesforce.resetPassword>    

Working with Utility

salesforcebulk.getServerTimestamp

The salesforcerest.getServerTimestamp operation retrieve the timestampt of the server. See the related API documentation for more information.

Sample configuration

<salesforce.getServerTimestamp configKey="MySFConfig"/>

Sample request

Given below is a sample request that can be handled by the emptyRecycleBin operation.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:urn="wso2.connector.salesforce">
    <soapenv:Header/>
    <soapenv:Body>
        <urn:loginUrl>https://login.salesforce.com/services/Soap/u/30.0</urn:loginUrl>
        <urn:username>XXXXXXXXXX</urn:username>
        <urn:password>XXXXXXXXXX</urn:password>
        <urn:blocking>false</urn:blocking>
    </soapenv:Body>
</soapenv:Envelope> 
Top