Salesforce Integrations

Different techniques to integrate with Salesforce

  • API
  • Mashup and Canvas
  • Email Service
  • Salesforce to Salesforce
  • Outbound messages
  • Salesforce connect
  • Web to Lead
  • Web to Case

 

 

API

SFDC REST API SFDC SOAP API Bulk API APEX SOAP API APEX REST API Chatter API Meta API Streaming
Protocol REST SOAP REST REST REST SOAP Bayux
Mode Sync Sync Async Sync Sync Sync( except photos) Async Async
Use cases Mobile applications, Web applications

Custom coding not required

Access Objects using REST

Backup objects not supported by Bulk API or files ( Attachments, FeedItem , Documents)

Legacy API, Small to medium data volumes

Custom coding not required

Access Objects using SOAP

Backup objects not supported by Bulk API or files ( Attachments, FeedItem , Documents)

Large data set

Custom coding not required.

Preserve governor limits regarding the number of API calls

Backup large data volume

Two modes - Serial and Parallel with retry option

Custom application logic

Multiple operations can be performed in a single call

Custom application logic

Multiple operations can be performed in a single call

Programmatic access to Chatter feeds, users, groups, and followers, files, recommendations, topics, notifications Access User Interface, Data model, business logic, customization Real time alerts

No polling

Pub-sub mechanism

 

Integration patterns

Remote Process Invocation—Request and Reply

Salesforce invokes a process on a remote system, waits for completion of that process, and then tracks state based on the response from the remote system.

Remote Process Invocation—Fire and Forget

Salesforce invokes a process in a remote system but doesn’t wait for completion of the process. Instead, the remote process receives and acknowledges the request and then hands off control back to Salesforce.

Batch Data Synchronization

Data stored in Lightning Platform should be created or refreshed to reflect updates from an external system, and when changes from Lightning Platform should be sent to an external system. Updates in either direction are done in a batch manner.

Remote Call-In

Data stored in Lightning Platform is created, retrieved, updated, or deleted by a remote system.

UI Update Based on Data Changes

The Salesforce user interface must be automatically updated as a result of changes to Salesforce data.

 

 

 

Remote Process Invocation—Request and Reply

A custom Visualforce page or button initiates

an Apex SOAP  or APEX HTTP callout in a synchronous manner.

Best
Trigger from Salesforce Suboptimal
Batch APEX job Suboptimal
Timeliness is of significant importance in this pattern. Usually:

• The request is typically invoked from the user interface, so the process must not keep the user waiting.

• Salesforce has a configurable timeout of up to 60 seconds for calls from Apex.

• Completion of the

 

Remote Process Invocation—Fire and Forget

Workflow-driven outbound messaging Best
Outbound messaging and callbacks Best
Custom Visualforce page that initiates an Apex

SOAP or HTTP asynchronous callout

Good
Trigger from Salesforce Suboptimal
Batch APEX job Suboptimal
Timeliness

Timeliness is less of a factor with the fire-and-forget pattern. Control is handed back to the client either immediately or after positive

acknowledgment of a successful hand-off in the remote system. With Salesforce outbound messaging, the acknowledgment must occur

within 24 hours; otherwise, the message expires.

 

Batch Data Synchronization

Change Data Capture / ETL … either way..scheduled Best
Remote call-in Suboptimal
Remote process invocation Suboptimal

 

Remote Call-In
SOAP API   or REST API Best
Apex Web services  or APEX REST service Suboptimal
Bulk API Optimal for bulk operations

 

UI Update Based on Data Changes

The optimal solution involves creating a custom user interface in Salesforce. It’s imperative that you account for an appropriate user

interface container that can be used for rendering the custom user interface.

 

Outbound messaging:  

Outbound messaging is a low code solution to integrate salesforce with external system. There is no need of polling salesforce. It is based on queuing, buffering functionality.

After setting up outbound messaging, when a triggering event occurs, a message is sent to the specified endpoint URL. The message contains the fields specified when you created the outbound message. Once the endpoint URL receives the message, it can take the information from the message and process it. To do that, you need to examine the outbound messaging WSDL.

Each SOAP Message can include up to 100 notifications.  

If object changes after notification and still in the queue, the updated info will be delivered. Messages are queued locally, a separate background process sends the messages.

If endpoint is unavailable, messages are queued, for 24 hours.  After 24 hours they get dropped.

After initial delivery attempt, the interval between retried increases exponentially, up to maximum of two hours between retires.  Messages may be delivered out of order and more than once.

Callingback Salesforce after processing the message in the external System is optional. It is recommend to specify a single user to respond to outbound messages and disabling this user's ability to send outbound messages by deselecting Send Outbound Messages in the user’s Profile

Use one profile to sending out messages and another profile to process inbound messages to avoid circular changes or infinite loop.

For security reasons, Salesforce restricts the outbound ports to one of the following:

  • 80: This port only accepts HTTP connections.
  • 443: This port only accepts HTTPS connections.
  • 1024–66535 (inclusive): These ports accept HTTP or HTTPS connections.

 

Few points about Setting up outbound messages

Select object, select fields, Select Include Session ID if you want a sessionId to be included in the outbound message. Include the sessionId in your message if you intend to make API calls back to Salesforce from your listener.

Messages may be delivered more than once.    Check NotificationID on client to make sure that the messages has or has not been processed.

 

Salesforce Client Cert

Application (endpoint) server's SSL/TLS may be configured to require client certificates (two-way SSL/TLS),

Security considerations

Client application server should whitelist only Salesforce IPS

Use SSL/TLS  

Use Organization ID in the message to confirm Org

 

Notification fields

Name Type Description
OrganizationId ID ID of the organization sending the message.
ActionId string The workflow rule (action) that triggers the message.
SessionId string Optional, a session ID to be used by endpoint URL client that is responding to the outbound message. It is used by the receiving code to make calls back to Salesforce.
EnterpriseURL string URL to use to make API calls back to Salesforce using the enterprise WSDL.
PartnerURL string URL to use to make API calls back to Salesforce using the partner WSDL.
Notification Notification Defined in the next section, contains the object datatype and its Id, for example OpportunityNotification or ContactNotification.

 

Enterprise WSDL Partner WSDL
One organization

Strongly Typed

WSDL Regeneration required for changes

Multiple Organization -- possibly

Loosely typed – Meta data driven , dynamic

APEX web services

Multiple DML statements on the SFDC tier as an atomic operation then use APEX web service as a single API call

 

Apex call out

Apex call out can be used instead of Outbound messaging. Apex callout inside a trigger cannot fire.  Use @future method that in turn does HTTP callouts.  It is asynchronous.

Canvas

Canvas is another way a third party application can be accessed in Salesforce. Canvas can use authentication, authorization, dynamic endpoint URL.

Mashup

Mashup is a quick, loosely coupled integration with external an application. For example displaying google maps in Salesforce. Advantages there is no need to bring large data in Salesforce and data is never stale. Data access may take longer time. Reporting does not work on the external data.

 

Salesforce to Salesforce (S2S) integration

It is possible to share data between two salesforce organization using native Salesforce to Salesforce (S2S) functionality.  Typical use cases are

  • Sharing data between two trading partners
  • Different departments/companies under one parent organization

The sharing must be enabled in both organizations and administrator must accept the sharing request. Granular control over what objects to share, fields to share and direction of sharing can be controlled.

 

Data Loader vs Import Wizard

Data Loader Import wizard
1. You can use more than 50,000 records.

2. You can insert, update,upsert,delete,export the data.

3. It cannot ignore the duplicate records.

4. You cannot schedule the data. ( exception OS scheduling )

1. You can use upto 50,000 records.

2. You can delete the records.

3. It can be ignored the duplicate records.

4. You can schedule the data.

Import Wizard allows only

A) Accounts and Contacts

b) Leads

c) Solutions

D) Campaign Member Status

e) And All Custom objects

 

Salesforce Connect

Salesforce Connect provides seamless integration of data across system boundaries by letting your users view, search, and modify data that’s stored outside your Salesforce org. For example, perhaps you have data that’s stored on premises in an enterprise resource planning (ERP) system. Instead of copying the data into your org, you can use external objects to access the data in real time

We recommend that you use Salesforce Connect when:

  • You have a large amount of data that you don’t want to copy into your Salesforce org.
  • You need small amounts of data at any one time.
  • You want real-time access to the latest data.

 

Connect Adapters

  • Cross-org
  • OData  2.0
  • OData  4.0
  • Custom adapter created via Apex

 

To avoid Record lock and performance

There might be something that can be done outside of salesforce

  • Pre-process data –
  • Group records by parent ID , PK chunking
  • Batch for insert and batch for update separately