MuleSoft Accelerator for Salesforce Service Cloud icon

MuleSoft Accelerator for Salesforce Service Cloud

(0 reviews)

Use case 1 - Order history

Overview

The following use case is covered:

  • Order History (Service Cloud <- OMS)

This use case shows you how to view the order history data from an external Order Management System (OMS) for the past 90 days within Service Cloud. The API should also allow searching for order history for a user-entered date-range.

High-level architecture

sfc-sc-order-history-api-led-architecture.png

Workflow

  1. Service Cloud requests order history for a given customer/account number
  2. Determine OMS to call, based on configuration.
  3. Call OMS and transform order data into a standard format.
  4. Return order information to API Client.
  5. In case of error, return proper error code to Service Cloud.

Sequence diagram

sfc-sc-order-history-seq-diagram.png

Systems involved

  • Service Cloud
  • OMS (currently represented by Apache OFBiz)

Setup instructions

Order Management System (OMS) configuration

For demonstration purposes this use case relies on the OMS System API, which has been configured to use Apache OFBiz as the back-end. The following steps can be followed to install and configure OFBiz for use by the accelerator assets.

  • Install the latest 17.x version of Apache OFBiz by following the supplied instructions.
  • Load default demonstration data using the command ./gradlew cleanAll loadAll
  • Create a new admin user for integration as ./gradlew loadAdminUserLogin -PuserLoginId=integrationadmin

The required OFBiz Web Services must also be exported in order for the OMS System API to be able to invoke them. These services are defined in services*.xml files under the servicedef folder for each domain. You can find the definition for a specific service by running the command find applications -name services*.xml | xargs grep <serviceName> from the OFBiz home directory.

To export a service, set the export="true" on the service definition and save the file. Restart OFBiz after modifying any service definitions.

Here is the list of services currently used by OMS System API (all file paths are relative to $OFBIZ_HOME/applications):

FilenameService
party/servicedef/services.xmlcreatePartyPostalAddress, quickCreateCustomer
accounting/servicedef/services_paymentmethod.xmlcreateCreditCard
order/servicedef/services.xmladdOrderItemShipGroup, createOrderPaymentPreference, findOrders, storeOrder
product/servicedef/services_shipment.xmlcreateShipment

The service names can be cross-referenced with the XML request templates and Transform Message processors in the OMS System API implementation template.

Mule projects

Follow the README instructions in the following Mule template projects to set up, deploy, and run these projects.

  1. Customers Process API | API Specification | Implementation Template
  2. OMS System API | API Specification | Implementation Template

MuleSoft Lightning Web Component (LWC) setup

The Lightning Web Component must be installed and configured to show order history information. See the MuleSoft LWC page for more information, as well as detailed instructions on how to install the Light Web Component in Service Cloud to view order history.

sfc-sc-lwc-components.png

Data elements & mapping

  • The table below illustrates the mapping from OFBiz order fields to the fields display by the LWC on Service Cloud
OFBiz field nameLWC field nameDescription
customerIdpartyIdUnique customer identification number
saleorderIdorderIdUnique Sale order number
orderNoorderIdUnique number assigned to this order and displayed to end users.
saleorderTypeorderTypeIdThe type of order. Change, Renewal or Amendment
originalOrderorderIdReference to the parent order. Needed for reship, exchange and even swap orders
saleorderStatusstatusIdCurrent order status e.g Draft, Read for Review, Placed, Read for Activation, Activated
orderstartDateorderDateDate at which the order becomes effective. For subscription-type orders, this would be the date when the subscription begins.
orderendDatenullDate at which the order ends. For subscription-type orders, this would be the date when the subscription ends.
promiseDatenullDate the promise of the order would be fulfilled
filedDateorderDateDate the order was filed

Reviews

TypeCustom
OrganizationMulesoft Inc.
Published by
MuleSoft Solutions
Published onJun 25, 2021
Asset overview

Asset versions for 1.5.x

Asset versions
VersionActions
1.5.1