Customer Relationship Management (CRM) systems are at the heart of the company’s go-to-market strategy and, along with E-Commerce, facilitate and track customer interactions. An important CRM implementation requirement is a near real-time integration with ERPs and other systems. Most of our customers run on the Salesforce stack as a target platform, and our services team has been assisting with various flavours of these requirements, including direct point-to-point connections, bulk data exports/imports, event-driven real-time flows, and even more exotic options such as embedding IBM i (AS/400) terminal emulators directly into Salesforce pages! In this article, we will discuss how to connect IBM i (AS/400 )to Salesforce with the MuleSoft Anypoint platform and infoConnect and use the example created by our Mulesoft and IBM i (AS/400) guru Nalini Goud.
The use case we will be walking through here is very straightforward and simplified for the sake of the demo and yet practical enough to be used as a starting point for production-grade integrations.
- When a new order is activated in Salesforce, it must be delivered to IBM i ERP in near real-time
- When the ERP order status is changed, the status must be propagated back to Salesforce in near real-time
Below is the high-level process diagram
The article title implies a direct connection between IBMi and Salesforce, which is correct at the high level but represents a typical integration anti-pattern of tightly coupling systems together via point-to-point integration. Instead, we follow a simplified API led connectivity approach here, decoupling the Salesforce and IBM i (AS/400) facing components and achieving a reasonable degree of reuse, while directly connecting one System API to another. To further evolve the design for more heterogeneous environments, it would be worth introducing the mediation/process layer between Salesforce and (AS/400) System APIs, that could implement more generic services such as routing, mapping, and orchestration.
Salesforce API Implementation
Salesforce acquired Mulesoft back in 2018, and as you’d expect most Salesforce integrations can be easily performed with the help of the feature-rich SFDC connector.
SFDC Order Poller
For the sake of simplicity, we choose to poll Salesforce for new activated orders. Alternatively, we could have implemented the near real-time streaming of order status events using platform events or push topics, both of which are supported out of the box with Mulesoft SFDC connector streaming source operations.
SFDC Order Status Update
This demo includes a simplified flow that retrieves SFDC order ID using ERP ID as a key and updates the status of that order in Salesforce.
IBM i (AS/400) API Implementation
IBM i (AS/400) is a modern, secure, stable, and highly sophisticated platform that offers one of the lowest total costs of ownership for running diverse workloads. There are various integration options provided out of the box and available from third-party vendors. For current or prospective Mulesoft customers, the easiest option is to leverage the infoConnect. It does not require any additional components to manage on IBM i (AS/400) or other platforms, and development teams can execute IBM i (AS/400) business logic and work with Data Queue messages directly from Mulesoft environments, with little to no IBM i special knowledge required.
Create IBM i (AS/400) Order
We used infoConnect for Mulesoft’s Program Call operation to directly execute the ERP program CRTORDERS from Mulesoft flow.
Program calls must be defined with the correct parameters that match exactly the order, data type, and size definitions of the back-end program or service program. Other than that, the Mulesoft developer does not have to have any knowledge of IBM i (AS/400) program internals or underlying database structures.
IBM i (AS/400) Order Status Listener
We used IBM i (AS/400) Data Queues for communicating the ERP change events. When an order is changed, the ERP creates a new data queue entry that contains the order ID, new status, and other relevant information. The Mulesoft listener process retrieves the data queue entry in near real-time and calls SFDC System API to update the order status. Once the call completes successfully, the Mulesoft process will send the order status acknowledgment message to the response data queue, to notify ERP that the event has been processed.
Salesforce and IBM i (AS/400) are both powerful, mature, and feature-rich platforms that offer a variety of connectivity options. Modern integration platforms such as Mulesoft Anypoint help decouple the systems, maximize the reuse, and reduce the niche skill requirements for connecting IBM i (AS/400) to Salesforce. The integration developers don’t need to have special training or experience integrating with IBM i (AS/400) servers, and with the help of infoConnect it can execute the back-end ERP business logic directly from the integration platform.
The source code for this demo application can be accessed here: https://bitbucket.org/infoviewsystems/as400-salesforce-demo