Internal Articles

Extending Salesforce with Outsystems

How to establish the integration connection with Salesforce

With Salesforce growth to be the world’s #1 customer relationship management (CRM) platform, it comes the time where we need to integrate our Outsystems custom applications to extend Salesforce functionalities with new and dynamic applications that can offer more flexibility and tools to help the users on a daily basis. This will enable the opportunity to have Salesforce data storage as a master database and the full capabilities of Outsystems applications.

In this article we will go through several topics, such as:

  • Integration with Salesforce
  • Tables and Fields selection from Salesforce
  • Create a Connection for the Integration
  • Massive synchronization
  • Queue synchronization

 

Integration with Salesforce

In order to establish the integration connection with Salesforce, you will need to access Integration Builder and connect to Dev environment with your Outsystems user.

Afterwards, in the Integrations Page, click on new Create Integration and select Salesforce. Since we will be in the developing stage and we do not want to affect Salesforce Production data, we recommend to have at least one Testing environment besides the Production environment.

Connect with Salesforce through Sandbox and this will redirect you to the Salesforce Login page so that you can login with the Service Account that will fetch and write data from this environment.

Tables and fields selection from Salesforce

Continuing the process started on the first topic, we will now be selecting the Objects we want to sync with Outsystems.

For a better understanding, here you will be able to select the Tables and in the Field section you will have access to the conventional naming of the field as well as the internal naming on Salesforce.

Continue the wizard, review everything and deploy the Integration.

Create a Connection for the Integration

To create a Connection for the Integration you will need to:

  • Navigate to the Integration Manager (https://<your_environment>/OSIntegrationManager/)
  • In the Connections page you will click on Create Connection.
  • After selecting Salesforce connection you will select if it’s Production or Sandbox environment and click Authorize Integration Manager to be redirected to the Salesforce Login page.
  • After finishing establishing the Connection, go back to Integration Manager, click on your Integration and select the Connection previously created.

Massive Synchronization

Coming back to Outsystems Service Studio you will notice that a service module with the “_IS” suffix was created with all the services provided by the Integration: Count[Table], Get[Table], Search[Table], Sync[Table]PickLists, etc.

To perform a data rollout to your own tables there are a few steps to follow:

  • Create Action to sync PickLists.
  • Create the Logic to fetch and normalize data – create Server Action to fetch [Table] records from Salesforce by batch and with the filters that you want. For example if you want to do a rollout by Country you want to have the Country previously selected entering as an input parameter to the filters.
  • Incorporate the first Logic on an upper level of Logic so that you can reuse the action of fetch data and afterwards introduce the cycle of creating data on your database.
  • Perform the first two steps for as many tables you want to synchronize.
  • Create the higher level of Logic and reference the SyncPickLists Action and the [Table]Sync Actions.
  • Create a Timer without Scheduling to run only when a new rollout is to be done and use the Action created in the point above.
  • Apply Timer best practices.
  • Set the correct Site Properties for example the Country.
  • Run the timer.

Queue Synchronization

In order to have a close to real time synchronization and to not overload the server with concurrent call to write on the database we need to implement a Queue Synchronization from Salesforce to Outsystems. To do this, we will need to follow the steps:

  • Create a Queue Entity with the following structure (Id, SalesforceRecordId, SalesforceTableId, OperationTypeId (Create/Update/Delete))
  • Create a POST REST API to be called by Salesforce in each record creation or modification.
  • Reuse the logic created for the Massive Synchronization but instead of fetching a batch of records you will fetch one single record by SalesforceRecordId.
  • Create the Action to process the queue, where you want to receive the SalesforceRecordId, SalesforceTableId and OperationTypeId. The SalesforceTableId will be used to choose the action from the point above that you want to call. After the fetch using the SalesforceRecordId to fetch the record, use the OperationType to choose which action you want to perform (Create, Update or Delete).
  • Create a Timer running every few minutes with an Action to read the Queue Entity by batch and send the record information to the action mentioned in the point above.
  • Apply Timer best practices.
  • Activate Timer.

Both for Queue Synchronization and Massive Synchronization is very important to build a well defined logging system to be easily monitored for possible issues that can happen. For that we recommend to:

  • Create logging specific table.
  • Define all exceptions that can happen in your code, (e.g. Field Mandatory on OS but not mandatory on Salesforce).
  • Structure the log message properly (ModuleName, ActionName, Message from the Raise Exception, JSON of the Record).
  • Create a daily email procedure to notify the findings of the day.
  • Create Log Screen.

Now that you have a replica of your master data in Outsystems you can leverage the Outsystems capabilities to develop better and more performant applications, while maintaining the integrity of the master data on Salesforce.

 

 

Gonçalo Condeça

Team Leader at AdvanceWorks, 6 years of Outsystems, focused on leveraging Outsystems capabilities while delivering high-end solutions to customers.

Internal Articles

Related Articles