Aug 11
Modelling a very complex business process flow in Dynamics 365 using the standard functionality can be quite challenging.
For example, the user first needs to search for and find the record in the system that they would like to process. Just this step can be prone to error if they select an incorrect record.
Then the user may need to create a new record, for example an “Order”, and submit this order to the Enterprise Resource Planning (ERP) system. There may be a delay between when the “Order is submitted” and when it is processed by the ERP system, preventing the user from moving directly onto the next step in the process.
All this manual processing of records in Dynamics 365 can be very time consuming for the user and lead to bottlenecks in the business process. That’s why we came up with an automation solution which would increase the throughput of the system.
This automation needed to be able to:
In this post I will explain the business requirement and provide an overview of the finished solution.
I would like to acknowledge the contribution of my colleague Michel Gueli, who was instrumental in the technical development of the solution. Together we were able to take the requirement, which was only an idea, give it shape and come up with a solution.
Our Cloud4Commodities solution, available in the AppSource, can be used to facilitate the capture of Trading Deals between two parties. This is a function completed by their Traders in the Front office.
The Logistical Settlement process of these deals is a function completed by Operators in the Middle Office.
There are two main processes which the Middle Office users perform in settling a Deal:
For both processes Dynamics 365 is integrated with ERP system:
As you can imagine, accurately tracking all the Receipts and Matching these to Deliveries is a time-consuming job for the Middle Office.
To find a solution which helps automate these processes for the Middle Office, we came up with two ideas:
Above is a high-level diagram of the final developed solution. Here I will describe each component of the solution.
As mentioned, a requirement of the solution was to expose the “Business Process Automation” functionality via an API so that a process could be initiated from outside of Dynamics 365.
This requirement was met by developing a RESTful web service, which runs in Microsoft Azure as an “App Service”.
Some notable methods supported by this service include:
Each Process that is submitted to the system is first validated. This means that the inputs are evaluated for correctness, preventing bad requests from being accepted and processed.
Every process in the system starts with the creation of a new Process entity record in Dynamics 365.
The screenshot above contains details such as:
We make use of a product from our “Products” business, called the Dynamic Scheduler, which is used to execute our “Process Engine” according to a configurable schedule/time frame.
The “Process Engine” will pick up active Process records and process these.
Every Process Step is first validated. If the Step passes validation, then it is executed.
E.g. If a Purchase Order Number has not yet been passed back from the ERP system, the next step responsible for adding the Stock to Inventory cannot execute.
Initially the “Process Engine”, will execute the first step of an active Process.
E.g. Create a Purchase Order for a Buy Deal.
When a Process Step action is executed, this action may lead to the creation of a record in the system. The system will then store the details of this generated record in a “Process Values” entity related to the Process.
E.g. We would store the PO Id of the Purchase Order created above.
The “Process Engine” is also responsible for advancing to the next defined step in the process or marking the Process as “Finished” once all steps have been executed.
By adhering to our approach and the design principles which we adopted, we managed to solve the following challenges:
The result is an extensible best practise solution and one which will save you money in the long run when it comes to future development on the system.