MuleSoft Integration with ServiceNow and Salesforce Service Cloud

Written by Muhammad Aqib Arif

Senior Software Engineer - Middleware

Salesforce integration is the process of linking Salesforce CRM and Cloud instances to other enterprise systems, such as ERP or SaaS applications or to each other. See how Salesforce integration and ServiceNow integration can power your organization. Integrate salesforce by unlocking data from Salesforce Service Cloud using MuleSoft API-led connectivity and lets service agents to gain deeper customer understanding better business processes in a single customer view. Many companies are leveraging service management platforms like ServiceNow to grow into a fully digital businesses, creating workflows online. MuleSoft’s Anypoint Platform connects ServiceNow to all enterprise applications.

Getting started with Service Now & Salesforce Integration

In this blog, we will see how to integrate Salesforce Service Cloud and ServiceNow with MuleSoft. The objective of this integration is to process an incoming X12 EDI 856 file in MuleSoft. If the file contains any errors or exceptions, then the incident should be generated in ServiceNow, and a case should be generated in the Salesforce Service Cloud. To achieve the objective, first, we will create three different mule flows. One for processing X12 EDI 856 file, one for Integration with ServiceNow, and another one for Salesforce Service Cloud. In the end, we will structure these flows to achieve the defined objective. A preview into how API-led approach changes the speed of innovation, letting faster channel integration with Service Now & Salesforce integration in a single customer view. But before we go into details, let us learn a little bit about ASN EDI 856 file.

What is X12 EDI 856 file?

The EDI 856 transaction is commonly called the EDI Advance Ship Notice or EDI ASN. It is used to deliver electronic communication regarding the shipment contents to another trading partner. It is sent prior to the shipment arriving at the other trading partner’s facility. The 856-ship manifest transaction is usually used by the retail, manufacturing, and automotive industries in response to EDI 830, EDI 850, or EDI 862 transactions. Furthermore, to detailing the contents of a shipment, the EDI 856 transaction also contains order information, types of packaging used, descriptions of products, carrier information, and much more. An EDI ASN may deliver information at various levels, including:

  • Shipment information like tracking numbers and carrier information
  • Order level information like purchase order numbers
  • Item level information that includes items and quantities
  • Pack level information like barcodes printed on each carton

Processing an X12 EDI 856 file in MuleSoft

MuleSoft provides X12 connector to support reading, validating, and writing X12 messages. For every trading partner, you can configure message validation options and configure schemas according to your trading partner's implementation convention.

The connector can generate 997 or 999 acknowledgments based on compliance with the partner configuration.

Steps to create a Mule flow to process an X12 EDI 856 file

  1. Search and add X12 Connector from Anypoint Exchange
  1. Drag and drop On New or Updated File component in mule flow and configure directory/file settings as you like
  2. Drag Read operation of X12 connector and drop it after On New or Updated File
  3. Add and configure Global Elements Properties for Read operation as mentioned in the image below
  1. Test connection and click OK
  2. Now configure Basic and General settings of Read operation as mentioned in image below
  1. Now convert X12 EDI 856 file to JSON, for that, drag Transform component from mule Palette and drop it after Read operation.
  2. Dataweave script of the Transform component should look like the image below.

This will convert X12 EDI 856 file to JSON

  1. Verify that Mule flow should look similar to the image below
  1. Now Drop an X12 EDI 856 file in the configured directory and verify if the data is successfully converted to JSON. Download sample X12 EDI 856 file from here

Integration of MuleSoft with ServiceNow

MuleSoft API-led connectivity provides ServiceNow connector. The ServiceNow connector lets businesses to sync ServiceNow data and extend IT service management (ITSM) abilities to SaaS and on-premises applications like Salesforce, SAP, Dynamics, and Workday, supporting with application integration, data migration and replication, and consolidation.

Steps to create a Mule flow to integrate with ServiceNow

  1. Make sure that you already have a ServiceNow developer account, and your ServiceNow instance is running.
  2. Search and add ServiceNow connector from Anypoint Exchange
  1. Drag Transform component from mule palette and drop to mule flow
  2. Drag Invoke operation of ServiceNow connector and drop it after Transform component
  3. Configure Global Element Properties for ServiceNow Connector. Configuration should be like the image below.
  1. Now configure General settings for invoking operation of ServiceNow as shown in the image below.
  1. Select the Transform component, which was added before invoking the operation, and add below Dataweave script to generate a message for ServiceNow incident.
  1. Add a Transform component after Invoke operation, which should convert ServiceNow response in JSON. Dataweave script for this Transform component should be the same as the image below.
  1. ServiceNow ticket generation flow should look similar to the image below.

Integration of MuleSoft with Salesforce Service Cloud

Anypoint Connector for Salesforce lets you connect to the Salesforce Bulk API, REST API, SOAP API, and Streaming API, depending on the process you configure.

Steps to create a Mule flow to integrate with Salesforce Service Cloud

  1. Drag and drop a subflow from mule palette and name it as Salesforce-CaseCreationFlow
  2. Add Transform component from mule palette to Salesforce-CaseCreationFlow and create data for Salesforce Service Cloud case
  1. Add and configure “Create” operation of salesforce connector after transform component in the flow
Global configuration
General configuration
  1. Add Transform component to receive response as JSON
  1. Now verify that the flow should look like the image below.

Structure these flows

Considering the scenario mentioned at the beginning of this blog, we will now structure the above integration flows to achieve the objective.

Follow the steps below

  1. Select X12 Read operation and Transform component and extract to sub-flow
  1. Add a Flow Reference after On File Created or Updated component and reference it with process-x12-ASN-fileFlow
  1. Add a Choice router component after the flow reference and configure choice. Add expression in the first option to check if X12 EDI 856 file has any errors
  1. Add two Flow Reference components in this option and reference them with snow- ticketGenerationFlow and salesforce-caseCreationFlow
  2. Drag On Error Propagate component and drop it in the Error Handling section
  3. Add two Flow Reference components within On Error Propagate and refer them with snow- ticketGenerationFlow and salesforce-caseCreationFlow. Now, if there is an exception while processing X12 EDI 856 file, then the incident will be generated in ServiceNow, and a case will be created in Salesforce Service Cloud.
  1. Test the complete flow by dropping an X12 EDI 856 file with a correct and incorrect format. If errors or exceptions found while processing the file, then the incident is generated in ServiceNow, and a case is created in Salesforce Service Cloud.
  2. You should be able to see a new incident created in ServiceNow if errors found while processing the file
  1. Click on the incident number and see the details
  1. Verify in Salesforce Service Cloud that the case has been created

Conclusion

Integrate Salesforce and ServiceNow with MuleSoft to drive elevated customer experiences and new revenue streams across the business. If you like to find out more on how Salesforce integration and ServiceNow integration could help you make the most out of your current infrastructure at the same time enable you to open your digital horizons with MuleSoft API-led connectivity across your business processes, feel free to reach us at [email protected] or visit www.royalcyber.com.

Leave a Reply