• Tejkaran Singh

No Code SAP and Salesforce Integration

Updated: Dec 17, 2021



SAP, is one of the most extensively used enterprise resource planning platforms on the market, is integral to many businesses' most vital business activities. Companies must link SAP with other systems within their organization in order to fully automate and improve key business operations. Integration between SAP and customer relationship management (CRM) solutions is one of the most popular SAP integration scenarios. Salesforce.com is the current dominant player in CRM applications and is now a trailblazer of Software as a Service (SaaS) applications. As a result, SAP and Salesforce integration, in particular, has become a rather common difficulty for businesses.


This article highlights the benefits and uses of SAP and Salesforce integration, as well as obstacles and new techniques along with the process of integration.


Benefits of integration


SAP and Salesforce integration are used to synchronize data between the two platforms. When data for a new client is loaded into Salesforce, for example, it is critical that this data is granted access in a timely manner for financials, performance evaluation, and other SAP-managed business operations. Other applications of SAP-Salesforce connectivity encompass:

  • SAP and Salesforce master product catalogs synchronized.

  • Sending data from Salesforce for won chances to SAP for invoice generating.

Companies can optimize and fully automate their business processes when SAP and Salesforce are correctly connected. SAP and Salesforce connection also benefits businesses in the following areas:

  • Dual data entry is no longer required, resulting in cost savings.

  • Manual data entry results in less data redundancy and errors.

  • Improved ability to react swiftly to fresh information.

Although the integration has been around for a long time, the difficulty of combining SAP and Salesforce is a relatively new one. ERP and CRM integration used to entail linking two or more on-premises applications before Salesforce became popular. The technological contrasts between SAP's on-premises solution and Salesforce's cloud-based delivery strategy necessitate a fresh approach to SAP and Salesforce integration.


Furthermore, previous techniques to integration have been expensive and time-consuming. In certain circumstances, the direct, point-to-point linkage has been used as a rapid, ad hoc solution to SAP and Salesforce integration difficulties.


Another option for integrating SAP and Salesforce is to use SOA stacks. While SOA stacks provide loose coupling between applications and give enterprises more flexibility to respond to changes, implementing a comprehensive SOA stack from a large vendor often comes with unacceptably high upfront costs and takes a very long time.


The best approach to combine SAP and Salesforce is to use Mule as an ESB.


Integrating SAP using an SOA stack is an alternative to point-to-point rapid solutions and expensive SOA stacks (Enterprise Service Bus). ESBs are a modern, lightweight, built solution for integrating SAP with other applications, such as SaaS solutions like Salesforce.


Mule is the first enterprise service bus that has been SAP-certified for SAP integration. Mule's SAP Enterprise Connector supports bidirectional connectivity and is compatible with SAP technologies such as:

  • Documents in the Middle (IDocs)

  • Interfaces for Business Application Programming (BAPIs)

  • Java Connector for SAP (JCo)

Mule as an ESB also offers industry-leading Cloud Connect technology, which may be utilized in conjunction with the SAP-certified connection to greatly ease integration with Salesforce's numerous APIs. Integration between SAP and Salesforce has never been easier thanks to Mule as an ESB.


Integration process


Create your first Salesforce integration for free.


The first step is to create a free account with Anypoint Platform and create a free account.


Migration


When you move a specific set of data from one system to another, you're doing data migration. This migration technique can be applied to a variety of Salesforce integration scenarios, such as transferring data from a legacy ERP system to Salesforce or consolidating CRM platforms. This pattern is designed to handle massive amounts of data, and the Batch Connector allows you to process records in batches.


Create a flow that monitors our HTTP endpoint for successful requests. When the HTTP endpoint is used, it will retrieve values from a database and create new leads in Salesforce for each of those values. Let's have a look at how this was created and how you may implement it in your own Anypoint Studio project.


Go to the Mule Palette after going to File -> New -> Mule Project. Drag the HTTP Listener into your flow after adding the HTTP module to your project. Set the port number to 8081 and the URL to /salesforce. Next, add the Database Module to your project in the Mule Palette. Select the Select connector and drop it into your flow.


By clicking the green + next to the Database connector, you can configure your connector. At the top of the Connection dropdown area, select MySQL Connection. Then, to automatically assign drivers to your connector, click the Configure button and select Add suggested libraries.


Add the following database credentials after you've added the JDBC Driver:


congo.c3w6upfzlwwe.us-west-1.rds.amazonaws.com is the host.

3306 (port)

Mulesoft is the user.

Password: Mulesoft

Congo's database

After that, click the Test Connection button to see if the connector can connect to the database successfully. Click OK, then type the following MySQL Query Text in the Query field:


SEARCH FOR * IN CONTACTS;

After that, add the Transform Message Connector to your flow and paste the DataWeave code below:



Then, in your flow, add the For Each Connector. This will go through all of the database's values, creating a new lead for each one.


Return to your Mule Palette and select the Salesforce module to add to your project. Drag and drop the Create Salesforce Connector into the For Each scope. Include your username, password, and security token in your Salesforce Config. After you've verified that everything is working, click OK. Select Lead from the Type drop-down menu, and then [payload] from the Records drop-down menu.


After that, drag the Create Connector under the Batch Step scope and add a Batch Job connector to the scene. This will asynchronously process all of the records, limiting API requests to Salesforce.


You've just completed the first flow. When you right-click and run your project, and use Postman to send a POST request to http://0.0.0.0:8081/salesforce, it will create a new lead for each record in your database. To access all of the lead's input from the database, log in to SFDC, click to Sales, then Leads in the main navigation.



Broadcast


The broadcast pattern sends data in real-time from a single source system to several destinations. This is known as a "one-way sync," and it is designed to handle records as soon as feasible. Broadcast patterns are also used to maintain data consistency across many systems.


We have a flow in the above screenshot that runs when Salesforce detects a new Lead has been added to Salesforce. The flow will modify the message payload and write it to two local CSV documents when a new lead is added. It will print out in the console that the flow has been successfully conducted once both of those activities have been completed.



Until the Scatter-Gather Connector moves on to the next stage in the flow, both acts must be completed. This is especially useful if you need to write to multiple ERP systems, databases, and other systems, and then continue the flow once the data has been sent to all of them. Let's take a look at how we built this integration:


To begin, drag the Mule Palette's On Modified Object Connector onto the canvas. A new flow will result as a result of this. Select Lead as the Object type under the On Modified Object Connector. Then, in your flow, add a Transform Message Connector.



Select the Scatter-Gather Connector from the Mule Palette's Core section. The Scatter-Gather component simultaneously sends the same message to different message processors. This indicates that the flow will not run until both procedures have been completed successfully. We'll add two File Write Connectors to the Scatter-Gather in this scenario. Add the following DataWeave code to each File Write under Content:



The path to the folder where you want these files to be produced is listed under Path. Write Accounts.csv at the end of the first expression and Accounts2.csv at the end of the second. Make sure APPEND is selected under Write Mode.


That concludes our discussion. When you create a new Lead in Salesforce, this flow will run and create two CSV files with the lead information inserted on your machine. Scatter Gather may be used to broadcast this data to additional systems in parallel using similar logic.


Aggregation


Aggregation is the most straightforward method of combining data from various systems into a single application. Developers can simply query several systems and integrate data to output to their target system using the aggregation pattern. Merging CSV files and sending the desired output to Salesforce are two common aggregate use cases.



When our HTTP endpoint receives a POST request, we have a flow that will run. When the flow runs, it will query two CSV files on different servers, integrate the data, and publish the results to Salesforce as a new lead. Fname, lname, company, email, and uuid are all included in the first CSV file. The second CSV file has the following fields: uuid, annua lrevenue, and phone. The above data transformation will add Phone and AnnualRevenue to the appropriate JSON objects in the initial CSV document, using UUID as a key. In essence, we're combining the data to generate a single result.


To start working on this integration, we'll add an HTTP listener to the scene. Then we drag the Scatter-Gather Connector into the flow, followed by two HTTP requests. The Method GET will be used for all HTTP requests, and the URLs will be as follows:


https://mulesoft.s3-us-west-1.amazonaws.com/userdata.csv


https://mulesoft.s3-us-west-1.amazonaws.com/moreuserdata.csv


Then drag two Set Variable Connectors into the scene, name them csv1 and csv2, and set each one equal to the payload.


Then, as the next component in the flow, drag a Transform Message. To the Transform Message, add the following DataWeave code:



This code adds AnnualRevenue and Phone to the correct entries in the other CSV document using the UUID's index. We're just matching up the indexes and then inserting the proper values where needed.


Finally, create a For Each Connector and place the Salesforce Create Connector inside of it. Select Lead as the type, and [payload] as the record type.


Drag the Create Connector beneath the Batch Step scope after adding a Batch Job connector to the scene.


Bidirectional synchronization


The act of combining two or more data sets from two or more different systems into a single system that recognizes the existence of different data sets is known as bidirectional sync. When separate tools or systems, each of which is required in its own right and for its own specialized goals, must perform different functions on the same data collection, this type of integration is useful. When you use Salesforce's bidirectional sync, you can use it as the primary system of record and then synchronize it with a secondary system like a database or an ERP system. Each system can operate at its best while retaining data integrity across both synced systems thanks to bidirectional sync integration. This allows you to add and remove systems in a modular fashion without fear of losing data.



The flow synchronizes accounts across Salesforce and database instances in both directions. The flow will retrieve data from newly created or changed accounts in Salesforce or the database instances. The integration triggers an insert or updates operation on the existence of the object in the target instance for the accounts that were identified as not existent in the target instance, using the most recent modification of the object as the one that should be implemented.


Check out the file posted on Exchange, which you can download and use immediately in your Anypoint Studio project to try out this template.


Correlation


The patterns of correlation and bidirectional sync are extremely similar, however, there is one significant difference. While bidirectional synchronization seeks to replicate the identical data elements in two locations, correlation connects dissimilar data records without copying the data. If fresh records are found in one system but not the other, bidirectional synchronization will create new records. In terms of object origins, the correlation pattern is inconclusive. It will synchronize things agnostically as long as they are found in both systems.


Correlation is useful when two groups or systems simply want to share data, but only if both groups or systems have records that represent the same items or contacts in reality. When more data is more costly than valuable, the correlation pattern is most useful since it scopes out the "unnecessary" data. For example, hospitals in the same health care network may desire to correlate patient data across hospitals for shared patients, but sharing patient data with a hospital that has never accepted or treated the patient would be a privacy breach.


The meaning of the term "same" across records is the most significant aspect when using the correlation pattern. This term varies with industry, as do the repercussions of ambiguous definitions. For example, in order to target offers to clients, the same name may suffice; but, at a hospital, relying on a name could have serious effects if two patients with the same name and different treatment plans have the same name. The table below shows what happens when the notion of "same" is applied too strictly, too loosely, or incorrectly across a correlation and bidirectional sync.


In Conclusion, each integration type is illustrated with a functional example, demonstrating how strong the MuleSoft platform is and how simple it is to interact with Salesforce using MuleSoft.


If you are looking to integrate platforms like these and much more seamlessly, look no further and connect with us today. Our highly expert and exceptional team at Apphienz has got your back. For more information, visit our website or get in touch with us!

87 views0 comments