In part 1 of this series, we highlighted the areas of the Sitecore Commerce engine which can be modified to enable the passing of orders and customers to an ERP system. If you completed the steps in the first article you should now have code “mocking” calls to an ERP. There is, however, nowhere in the system for back-office users to view the fields containing integration status of business entities.

For example, we added a field called “Is integrated” to our “Order” business entity but how will the end user know that the process succeeded without calling the API or searching for the order in the destination ERP system?

The following article will outline the process of modifying the entity views to show the custom fields that were added to the order and customer entities via components in part.

The final result will look something like this…modified view

The example is made up of the following artifacts:-

  1. A new pipeline block extending the functionality of the “GetEntityView” pipeline.
  2. A new pipeline registration

Modifying the entity views to display the integration fields in the business tools

We are going to modify the standard process within the system to do the following:-

  1. A user opens the “Customer and Order Manager” section from within Sitecore, selects the “Orders” tab, then selects an order from the list (Unchanged)
  2. A call is made to the Sitecore Commerce API for the views relating to the “Order” entity. (Unchanged)
  3. The “GetEntityView” pipeline is fired (Unchanged)
  4. The relevant view for the “Order” entity is modified in the pipeline and passed back through to the UI.
  5. The same process is followed for the “Customer” entity

Open the SDK example solution

  1. Open the project named “Sitecore.Commerce.Connectors.MYERP.Plugin” that was created in part 1.
  2. Under “Pipelines\Blocks” add a new class named “ModifyViewsBlock.cs”
  3. Copy the code below into the class and cleanup as necessary

The code above is called for every request for every entity view but the “if” statements at the top of the block ensure that the code is run at the correct time. After the block validates that is should run correctly, the entity within the call is retrieved and the custom fields are pulled from the plugin components and returned in the view

Registering the new block against the pipeline

  1. Open the class named “ConfigureSitecore.cs” at the root of your project
  2. Add the following code to the “ConfigureServices” method…

The full class should now look like this…

Running and debugging the example

Verify your solution, should look like this…

 example solution - part 2


To test that your code is working

  1. Ensure that you have followed the steps in part 1.
  2. Start IIS Express by starting the demo solution
  3. Go to Sitecore and select “Customers and orders manager” from the launchpad
  4. Select the “Orders” tab
  5. Select an order from the list that has been processed by the “ReleasedOrdersMinion” (refer to part 1).
  6. If you have breakpoint added to the new pipeline code it should be hit now.
  7. The Preview section on the right should contain your custom fields. If you view the details of the order, the other custom fields will be shown.
  8. Debug the new pipeline block to see how it works.
  9. Repeat these steps for customers

customer preview


In other posts, I plan to show the following.

  1. New API functionality to resend orders to the ERP.