Context
As we all know, Salesforce is #1 cloud-based CRM platform. Salesforce offers several different kinds of cloud solutions for different part of business. Salesforce offers solutions for Marketing, Sales, Service, Support, Collaboration, Integration, Analytics, AI and more. Well, you are thinking if Salesforce offering solutions for all different part of businesses, then why do we need integration.
Since Salesforce is a CRM System that is actually a client facing application. It needs to connect to different backend and other operational systems to generate 360 Degree view of a customer. At the same time, any changes in this system needs to be sent to other systems. Salesforce needs to integrate with Billing systems, fulfillment systems, order management systems, inventory management systems, content management systems etc. It means for one or other reason we have to integrate Salesforce with one or more external systems.
If we go back few years in past, we used to write complex APEX to meet the integration requirements. Integration used to be considered as specialized Salesforce skills. Last few years, Salesforce innovation team spent lot of time to make integration easier and seamless and it does not require a specialized skills for Salesforce development team.
Well, Integration still has lot of complexity, and it is good to understand all these complications, but it is not mandatory for Salesforce consultants and developers. Salesforce offers lot of integrations design pattern that do not require any APEX coding. In this article I would be discussing one of most powerful Salesforce Integration Design pattern that does not require any coding. Yes, I am talking about event-based integration using Salesforce Platform Events
I would explain this with a simple real-time requirement to understand the solution.
Business Requirements
Customer Phone Number, Address and Email Update: Since Salesforce is a CRM system, an existing customer calls a support executive and requests to update her address, email and phone number. Support executive verifies basic details and makes an update to customer record. Address, phone and emails are basic but one of the most important pieces of information and if this information is not updated in all other systems, then it may have big impact. There could be few packages at fulfillment centers not yet dispatched and requires address update, customer may request OTP on email and phone for accessing online account and it may not work if information is not updated, Biling department may require to follow-up with customer to check a pending invoice and could be more. As you understand, a small update in CRM systems if not integrated with all other systems, may impact the overall customer experience and may result in losing the customer.
Now you understand the requirement. We would like to ensure if a client information is updated in Salesforce, all other systems need to be updated with this information.
Integration Solution
If you are working on an Integration Solution, you need to consider many things. Some of the basics you need to consider are: –
- Synchronous / Asynchronous: For this requirement Salesforce is sending some changes to external systems and not expecting anything back from other systems. From Integration Design perspective, we can go ahead with asynchronous approach as it would be happening in background and would not impact user.
- Realtime / Batch: As you see the requirement, we need to publish these changes to all other systems as soon as possible. This should not be batch solution that runs nightly or every few hours. It needs to be real-time.
- Message Complexity: Integration design may have impact if you are sending updates for single record, or you are sending multiple records for example one order with multiple line-items. In this scenario, we have to send 8-10 attribute of single customer record. I would cover integration that uses complex messages in another article.
All these considerations support event-based integration design pattern. Platform Event would be a good solution for this requirement. Some of reason, we would like to go ahead with Platform Event based integration solution here are: –
- Event-based integration is a recommended design pattern to explore for this kind of integration requirements.
- We do not need any APEX code or any specialized skills. Basic configuration knowledge would be sufficient.
- We can publish the change as event message, and it can be consumed by one or more external systems or middleware solutions. We do not have to publish one message for each external system.
- Message would be delivered in near real-time, but it would be persistent for 72 hours. It means if one of the systems are down or having any connection issues, it would not impact the integration.
- We may not need to work on security aspect for other systems. If they are integrating with Salesforce for other integration, they can use the same authentication mechanism.
High Level Solution Design
I am not going to provide you screen shots of how to create Salesforce fields, flow or event. I am going to list down the high-level steps that you have to follow to solution this requirement. Steps are listed below: –
- New Platform Event
- Create a new Platform Event. Creating platform event is similar to creating new Salesforce custom object but the name would end with __e instead of __c
- Create custom fields on Platform Event Object. Create one field for each data element you are sending to external systems like Phone, Email, Street Address, City, State, Zip Code, Country etc… You may have a generic customer platform event object for new and modify scenario (as needed)
- Create custom field for Global ID (External ID / Salesforce ID / Customer Number) that would be used by all external systems to identify the customer record.
- Record Triggered Flow
- Create a new record triggered flow or modify existing if you have one that triggers on customer update
- Create a record in Platform Event Object with all the information you are integrating along with necessary fields to identify the customer record
- Unit Test your changes and provide the necessary details to integrating systems
Summary
This is all we need to setup integration for this business requirements. External applications and middleware tools can subscribe to Salesforce Platform Events using one of the supported methods. Refer this link