Skip to main content

Multi Org spin out (Hub-Spoke) and Change Data Capture (CDC) in Salesforce.com

Why Multi Org ?


Having all sales , service and marketing clouds on a single org is no more a good practice from overall Org strategy point of view. Having everything on one instance makes sense from data availability point of view but this is not more an excuse since near real time data can be access using various channels on Salesforce platform.

Having everything in one org have some other limitations , to start with the governor limits which can be seen in terms of code character usage , data storage constraints , sharing related issues like hiding sales data to anyone else in the org who are not intended to know those.

While moving Sales , Service & Marketing clouds into separate Orgs solves all these problems.

hub spoke salesforce
Hub Org should be the Master Org where all the Orgs data is synced. This Org can be used for analytics purpose and also can act as backup database.

There may be instances where Service cloud need to see sales cloud data. For example , Case management might require account details. 

How to Sync data between Hub and Spoke Org ?

Since all these instances are salesforce we might consider using Salesforce-to-Salesforce (S2S) feature . This might look a good option but there can be some challenges in going with this approach. Here are few limitations :-
  • If there is any record sync failure due to some custom validation or some other exceptions , we don't have any retrial option to sync the failed records. Also , manual monitoring is required.
  • Not all Objects are supported by S2S . For example Entitlements , Notes etc.
External Objects are good for view purpose but the records which need to be updated in multiple instances can cause record lock issues. Also , external object currently don't allow workflows or process builders which eliminates this from our list of viable options.

We can try using steaming API push topic which can be fed to Mulesoft and later synced to hub org,but it comes with lot of limits too. 

We can also try the REST polling mechanism where we get list of  records inserted/updated/deleted in a given interval. Then further describe call is made to get record detail.
It gives a snapshot of all fields which can become an overhead to process increasing the processing time.

Finally , we have a mechanism which sends us platform events which is crisp and up to the mark. This is called Change data capture (CDC) .
CDC gives us exactly the fields which were changes during one update , insert or delete operation , making our life easy.

This is how a sample CDC even look like -

{
"data": {
"schema": "IeRuaY6cbI_Hs7hr61Mc5g",
"payload": {
"ChangeEventHeader": {
"entityName": "Case",
"recordIds": [
"<record_ID>"
],
"changeType": "CREATE",
"changeOrigin": "com.salesforce.core",
"transactionKey": "001b7375-0076-257e-e6ca-brcyufyi8b69f",
"sequenceNumber": 1,
"isTransactionEnd": true,
"commitTimestamp": 15015678653,
"commitNumber": 568056772780,
"commitUser": "<User_ID>"
},
"CaseNumber": "123456",
"Description": "Faulty Keyboard?",
"OwnerId": "<Owner_ID>",
"CreatedDate": "2017-08-05T19:10:11Z","CreatedById": "<User_ID>",
"LastModifiedDate": "2017-08-25T19:16:44Z",
"LastModifiedById": "<User_ID>"
},
"event": {
"replayId": 7
}
},
"channel": "/data/ChangeEvents"
}

Further these events can be easily processed using open source KAFKA or Mulesoft and the different Orgs can keep their data in sync with Hub.

Comments

Popular posts from this blog

Einstein Bot user authentication

Using Bot for data manipulation use case in your company requires need of implementing some extra security layer to make it spoof proof. One of exciting salesforce feature we have is the well known Einstein Bot which many companies have implemented. I am going to cover detail step-by-step implementation of User validation use case using encrypted token. STEP-1: Create a Site & Site User go to setup > Sites & Domains > Sites Create a Site and make your user as "Site Contact". This is a prerequisites for live agent or Embedded Service setup. STEP-2 : Create a Embedded Service(formerly snap-ins) go to Service setup > Embedded Service Create a new Embedded Service Deployment record and copy the embedded service code snipped generated in a notepad. STEP-3  : Create a Visualforce page to test the chatbot (it will simulate the actual web portal which is going to consume the embedded service snipped.) BotController.apxc public class BotControlle...

Dynamically populate lightning:combobox

In order to dynamically populate values in lightning:combobox using javascript we can create a list variable and push the values. We also require the values like ids associated to the particular option for back-end logic. For example  : If we want to show the list of contacts using lightning:combobox component where the option should display the contact name but the value should be the contact id which will be used for back-end logic For this we can create a temporary Map variable in our lightning component and set the value and label parameters of the lightning:combobox. Here is the code for this component Combo.app <aura:application extends="force:slds" access="global" description="Lightning Combo Demo"> <c:Combo_Cmpt/> </aura:application> Combo_Cmpt.cmp <aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="ComboController"> <!-- ...

Use of wrapper class in lightning:datatable

As you guys know the wrapper class concept in visualforce pages , we generally use it to create a data-table which fetches data from different objects or if we want to redirect user to some other page on click of a link as one of the column of data-table.        For example we want a column "Account Name" on the data-table which is a link and once user clicks it should redirect respective account record. Or , suppose we want to display a column with some images or icons as a visual indicator Or what not. These requirements require us to use a wrapper on the lighting data-table (lightning:datatable) I am going to use my previous account search example ( Account Search Lightning Component ) and explain the use of wrapper. AccountSearchWrapper.app <aura:application extends="force:slds" access="global" >     <c:AccountSearchWrapper /> </aura:application> AccountSearchWrapper.cmp <aura:component controller="...