How to connect different types of processes in Microsoft Dynamics CRM 2013. Real business case
Introduction
We want to share the experience of a small but useful improvement in the functionality of working with business processes of various types in Microsoft Dynamics CRM 2013. Our approach does not claim to be genius, but it allowed us to solve some of the problems that we will describe below, as well as fulfill the wishes of the Customer. Maybe the case will be useful to someone in their work.
Some types of processes in Microsoft Dynamics CRM 2013
Business process
In Microsoft Dynamics CRM 2013, there is a rather good workflow automation functionality, which is a sequence of steps that, in turn, can be used to automate real business processes based on the Windows Workflow Foundation.
Processes of this type are widely used in the design of real business processes of the company and can very effectively automate the collective work of users within the standards established by the company.
The most frequently used functionality of business processes in Microsoft Dynamics CRM 2013 is the management of object statuses depending on certain parameters according to conditions, the automatic generation of object attribute values, the automatic generation of tasks and notifications to employees involved in a business process: The
functionality of this type of process is described in great detail in the materials of Microsoft, third-party teaching materials and various thematic resources, therefore, we will not dwell on its description in detail.
Business Process Flow
In addition to the above functionality, Microsoft Dynamics CRM 2013 introduced a new functionality - the sequence of operations of a business process (Business Process Flow), which is a new visual interface in the form of a step-by-step panel for objects with which you can determine and control the execution of certain steps at each stage process. The main distinguishing features of the new functionality:
• there may be different processes for different security roles;
• it is possible to prohibit the movement between the steps of the process if no actions are performed;
• cross-object process functionality.
The main advantage of this type of process is that it acts as an assistant for the user when passing through specific business processes and is a visualization of the stages for writing. At each stage, there are steps that are filled in by the user. Having completed all the requirements at the current stage, you can go to the next stage. Each Step and Step can be configured: The
undoubted advantages of using this type of process (which users liked) are:
• visualization of the sequence of steps and steps in a step, which minimizes the likelihood of erroneous user actions;
• the ability to determine the required attributes of an object, depending on the stage of the business process, which minimizes the incompleteness of filling the required amount of information.
The disadvantage of this type of process is that switching between the steps is performed manually by pressing the button "Next stage" of the tape of the sequence of operations of the business process on the form. When using the regular mechanism in the collective work mode, the users involved in the process could not see each other's actions and respond to them in a timely manner (for example, to set tasks).
Our goal was to eliminate this shortcoming.
Setting a business task
How to combine the functionality of different types of processes?
Consider the implementation of the required functionality on the example of the implementation of the business process of preparing, coordinating and submitting reports on business trips (real business case).
At the Customer’s company, business development is associated with a large number of manager’s business trips to clients, much attention is paid to work planning to achieve sales efficiency, as well as reporting (reporting on the results of work and financial reporting). A business process involves the participation of various user groups that are geographically dispersed.
Accordingly, the Customer needed:
• creating a new system section for working with the “Business trip” object;
• development of a business process as a means of teamwork;
• development of the sequence of operations of a business process on an entity form for clarity of actions and the correctness of the information entered.
The business process of working with business trips contains four stages (main points):
• “Preparation” - the formation by the manager of the goals of the trip, work plan and budget for the trip;
• “Coordination” - approval by the sales department of the work plan and approval by the finance department of the business trip budget (or return for revision or actual deviation);
• “Results” - the formation by the manager of the results of work during a business trip and financial statements;
• “Approval” - approval by the sales department of the results of work and approval by the financial department of the financial report and the closure of a business trip (or return to finalize the results and provide additional reporting documents).
Implemented solution
Business process
At each stage of the business process of working with business trips, the following typical actions must be performed:
• send an e-mail notification to the process participants about the need to enter certain information to perform the following steps of the process stage;
• automatically change the status of the Trip object depending on the stage of the process;
• if the actions performed at the previous stage are rejected, automatically return the process to the stage back to correct the data.
To implement this functionality, a new business process “Business Trip - BP” is created:
For the tasks in the business process, it is enough to describe the conditions for completing each step of the process step, create message templates for sending to the corresponding participant in the process and set the conditions for changing the record status (movement through the stages of the business process), as well as the conditions for starting a business process in the background.
The entire business process should not be described in detail - everything was done using the standard functionality of Microsoft Dynamics CRM 2013, it is enough to carefully describe the stages of the business process (unfortunately, the lack of a graphical interface when designing business processes is a weakness of the system).
Moreover, our goal is not to describe a real business process, but to show how to interconnect different types of processes.
Business Process Flow
Next, for the new “Trip” object, create a sequence of operations of the business process and describe its steps, including the mandatory attributes of the object to be completed at each step of the process:
Thus, for the “Trip” object, we visualized user actions on the form:
Connection of the business process and the sequence of operations of the business process
now remains for us to link the two types of processes, that is, to solve the problem of automatic control step workflow of a business process based on the background of the business process.
Thus, we achieve the following results:
• when working with the “Business trip” object, the user has visual “instructions” on the necessary actions;
• a business process in the background provides the logic of the process of working with a business trip;
• switching stages of a process of the type “sequence of operations of a business process” on the form of the “Trip” object takes place automatically, does not require manual actions by the user;
• in the form of an object "Trip" always reflects the current stage of the process (including when returning to the previous stage).
We modify the “Trip” object by adding new statuses in the StatusCode field:
• Preparation;
• Coordination;
• Results;
• Statement.
The statuses of the Trip object now correspond to the steps in the sequence of operations of a business process.
Next, in the conditions of the business process, let us update the StatusCode field of the Trip object to the corresponding status values generated earlier.
The last step is to ensure that the step of the business process sequence for the Trip object is automatically updated to the value that is set automatically in the step of the business process.
To do this, we need to add a small script to update the steps on the form of the "Trip" object:
Open the form of the "Trip" object, go to the "Form Properties" section, add the script file, and in the "Event Handler" section add the updateProcessStep method.
The script itself for automatically updating the status is very simple and looks like this:
function onChange() {
var stageStatus = Xrm.Page.getAttribute("statuscode").getText();
OnNextStage(stageStatus);
}
function OnNextStage(stageStatus) {
var processId = Xrm.Page.getAttribute("processid").getValue();
var oDataURI = Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/ProcessStageSet?$select=ProcessStageId,StageName&$filter=ProcessId/Id eq (guid'" + processId + "')";
$.ajax({
type:'GET',
url: oDataURI,
dataType:'json',
contentType:'application/json; charset=utf-8',
success: function(msg) {
var nextStageId = null;
for( var i=0; i
Заключение
Задача, поставленная Заказчиком, выполнена, цель достигнута. Бизнес-процесс и последовательность операций бизнес-процесса работают совместно. В рамках бизнес-процесса обеспечивается автоматическое переключение этапов последовательности операций бизнес-процесса, а наглядность процесса на форме обеспечивается визуальной поддержкой регламента.
На данном простом примере мы постарались показать, как можно расширить функционал работы с процессами разных типов в Microsoft Dynamics CRM 2013 и, возможно, сделать систему более комфортной для конечных пользователей.