Sitecore Salesforce Integration using Azure Microservices

Sitecore SalesForce Integration using Azure Logic Apps


During one of my projects, we had a requirement to integrate Contact Us form data on a Sitecore Website with SalesForce as new Lead objects. Our forms used to be Sitecore WFFM based but were rebuilt as custom Sitecore MVC forms.

Looking at the existing Integration options available I found these two:

1      Sitecore Connect for Salesforce CRM 2.0 [https://dev.sitecore.net/Downloads/Salesforce_Connect/2x/Sitecore_Connect_for_Salesforce_CRM_20.aspx]

2)      FuseIT S4S Connector
[https://www.fuseit.com/products/sitecore-salesforce-integration/]

Sitecore Connect for Salesforce CRM 2.0


This Sitecore connector is developed by the “Sitecore Integrated Solutions Team” and is free and open source. It’s built on top of the Sitecore Data Exchange Framework.

On a high level, the Salesforce Connect provides a connector for Salesforce.com that provides the following capabilities:

·       Salesforce contacts are exposed as Sitecore users
·       Sitecore user management tools can be used to create/edit/delete Salesforce contacts
·       Salesforce contact data is saved in xDB (as a contact facet)
·       Fully extensible pipeline-based architecture
·       API that allows you to read from and write to Salesforce
·       Source code is available

The connector is tightly integrated with Sitecore and provides many features out of the box. Based on the documentation that’s available for the Salesforce Connector and the Salesforce CRM Provider for Data Exchange Framework 2.0, I was unable to find information on how/where it implemented working with Lead objects in Salesforce, it mostly focuses on integrating Contacts (Sitecore Experience Profiles vs Salesforce Contacts) amongst other features.

Based on this, the Sitecore Connect for Salesforce CRM is not meeting my current needs, onwards.

FuseIT S4S Connector


“The S4S connector integrates Sitecore CMS with Salesforce allowing the seamless exchange of information. With real-time bi-directional communication, almost any object in either system can be made visible to the other. For example, Salesforce documents can be made accessible on the website to selected users. Even website login credentials can be stored and controlled in Salesforce contact records. Among its many uses, S4S lets organizations collect leads from web forms and push the form data, along with Sitecore Experience Analytics, to Salesforce allowing fast and easy qualification.”

This is an Enterprise-grade connector, great features but due to cost and number of features we would actually use right now it’s also not meeting my needs to integrate to Salesforce.

So I discovered Azure Logic Apps.

What is Azure Logic Apps

As described on Microsoft's docs:
"Azure Logic Apps is a cloud service that helps you automate and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations. Logic Apps simplifies how you design and build scalable solutions for app integration, data integration, system integration, enterprise application integration (EAI), and business-to-business (B2B) communication, whether in the cloud, on premises, or both.
For example, here are just a few workloads you can automate with logic apps:
  • Process and route orders across on-premises systems and cloud services.
  • Send email notifications with Office 365 when events happen in various systems, apps, and services.
  • Move uploaded files from an SFTP or FTP server to Azure Storage.
  • Monitor tweets for a specific subject, analyze the sentiment, and create alerts or tasks for items that need review.
To build enterprise integration solutions with Azure Logic Apps, you can choose from a growing gallery with 200+ connectors, which include services such as Azure Service Bus, Functions, and Storage; SQL, Office 365, Dynamics, Salesforce, BizTalk, SAP, Oracle DB, file shares, and more. Connectors provide triggersactions, or both for creating logic apps that securely access and process data in real time."

Integrating Sitecore and Salesforce via Azure Logic App

Our project's Sitecore infrastructure is already hosted in Azure (non-PaaS) and I stumbled upon Logic Apps while browsing through the Azure Portal. I noticed they provided a Salesforce Connector and I then created a Logic App proof of concept. If you are familiar with SSIS, BizTalk or Azure Service Bus the workflow based interface makes natural sense and the ease of use to build a logic app is great. 

You can literally build the Logic App in a few minutes and utilize all of the other great features that Azure provides such as Monitoring/Alerts, Security and a central place for Operational teams to monitor the Logic App execution with all the other Azure resources. Here's some of the options available:





On a high level, here's the integration process flow:


Here's an overview below of the creation of the Logic app and the Logic App Designer:

1) Create a new Logic App via the All Resources section in Azure Portal:


2) Select the default trigger that will kick off the Logic App workflow. In our case, we use the "When a HTTP Request is received"


3) You then create a JSON schema so that the Logic App can understand the structured request and re-use the request fields in the other Workflow steps of the Logic App:




4) Now that we have our request data (Salesforce fields) coming into the Logic App, we add the Salesforce Connector as the next action and map the fields from the JSON request to the Salesforce Create Record action:






5) Lastly, we use the LeadID in the Salesforce response and send that back to Sitecore using the "HTTP Response" action block.


There's also Logic App Code View that shows you the JSON data for the entire Logic App Workflow:


Logic App Error


During testing with Postman, I didn’t set the Content-Type to “application/json” on one of my tests. This resulted in the Logic App failing with the error below, make sure the Content-Type Header value is always set in requests.


InvalidTemplate
. Unable to process template language expressions in action 'Translate_text' inputs at line '1' and column '1667': 'The template language expression 'triggerBody()?['TranslateTextVal']' cannot be evaluated because property 'TranslateTextVal' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.


Cheers /F

Comments

Post a Comment

Popular posts from this blog

Sitecore Custom Language Registration and Fallback

Sitecore 8.2 Processing Server - Performance Tuning