📜 ⬆️ ⬇️

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 of the functionality of working with business processes of various types in Microsoft Dynamics CRM 2013. Our approach does not pretend to genius, but it allowed us to solve some of the problems that we describe below, as well as to 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


Buisness process

In Microsoft Dynamics CRM 2013, there is quite good functionality for automating workflow, which is a sequence of steps that, in turn, can be used to automate real business processes based on Windows Workflow Foundation.
')
Processes of this type are widely used in designing real business processes of a company and make it possible to very effectively automate the collective work of users within the framework of the standards established in the company.

The most frequently used functionality of Microsoft Dynamics CRM 2013 business processes is the management of object statuses depending on certain parameters by conditions, automatic generation of object attribute values, 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 Microsoft materials, third-party methodological materials and various thematic resources, so we will not dwell on its description.

Sequence of business process operations

In addition to the above functionality, Microsoft Dynamics CRM 2013 has a new functionality - the business process flow (Business Process Flow), which is a new visual interface in the form of a step-by-step panel for objects, with which you can define and control the execution of certain steps at each stage process. The main features of the new features:
• different processes may exist for different security roles;
• it is possible to prohibit movement between process steps if no action has been taken;
• cross-object process functionality.
The main advantage of this type of process is that it acts as an assistant for the user during the passage of specific business processes and is a visualization of the passage of stages for writing. At each stage there are steps that are filled in by the user. After completing all the requirements at the current stage, you can proceed to the next stage. Each Stage and Step can be customized:



The undoubted advantages of using this type of process (which users liked) are:
• visualization of the sequence of steps and steps at the stage, which minimizes the probability of erroneous user actions;
• the ability to determine the required attributes of the 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 stages is performed in manual mode by pressing the “Next stage” button of the workflow flow sheet on the form. When using the staff 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, set tasks).
Our goal was to eliminate this shortcoming.

Setting a business problem


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, agreeing and submitting reports on travel (real business case).
In the company of the Customer, business development is associated with a large number of travel managers to customers, great attention is paid to work planning to achieve sales efficiency, as well as reporting (reporting on the results of the work done and financial reporting). The business process involves the participation of various user groups, separated geographically.
Accordingly, the customer required:
• creation of a new system section to work with the “Business trip” object;
• development of a business process as a means of teamwork;
• development of the sequence of business process operations on the entity form for visualization of actions and correctness of the information entered.
The business process of working with travel includes four stages (highlights):
• “Preparation” - formation by the manager of the objectives of the trip, work plan and budget of the trip;
• “Approval” - approval by the sales department of the work plan and approval by the finance department of the budget of the trip (or return for revision or actual deviation);
• "Results" - formation of the manager of the results of work during the trip and financial reporting;
• “Approval” - approval by the Sales Directorate of the work results and approval by the financial department of the financial report and closing of the trip (or returning the results for revision and provision of additional reporting documents).

Implemented solution


Buisness process
At each stage of the business process of working with travel, you must perform the following typical actions:
• send an e-mail notification to participants in the process of the need to enter certain information for the next steps in the process;
• automatically change the status of the “business trip” object depending on the stage of the process;
• when rejecting actions performed in the previous step, automatically return the process back to the stage to correct the data.
To implement this functionality, a new business process “Business trip - BP” is created:



For the tasks set in the business process, it suffices to describe the conditions for completing each step of the process step, create message templates for sending to the appropriate participant in the process and set the conditions for changing the record status (moving through the stages of the business process), as well as the conditions for starting the business process in the background.



You don’t need to describe the whole business process in detail - everything is done using standard Microsoft Dynamics CRM 2013 functionality, you just need to carefully describe the stages of the business process (unfortunately, the lack of a graphical interface in designing business processes is the weak side of the system).
Moreover, our goal is not to describe the real business process, but to show how to connect different types of processes.

Sequence of business process operations

Next, for the new object “Business trip”, we will create a sequence of business process operations and describe its steps, including the mandatory object attributes filled in at each step of the process:



Thus, we have implemented for the object “Trip” a visualization of user actions on the form:



Relationship business process and business process flow

Now it remains for us to interconnect two types of processes, that is, to solve the problem of automatic control of the stages of the sequence of operations of a business process based on the background business process.
Thus, we achieve the following results:
• when working with the “Business trip” object, the user has a clear “instruction” on the necessary actions;
• business process in the background provides the logic of the process of working with a business trip;
• switching stages of the process type “sequence of business process operations” on the form of a “business trip” object occurs automatically, it does not require manual user actions;
• in the form of the “Business trip” object, the actual stage of the process is always reflected (including when returning to the previous stage).
We modify the “Business trip” object by adding new statuses in the StatusCode field:
• Training;
• Coordination;
• Results;
• Statement.



The statuses of the “Business trip” object now correspond to the stages of the sequence of business process operations.
Next, in the business process conditions, let's set the update of the StatusCode field of the “Trip” object to the corresponding status values ​​generated earlier.



The final step is to ensure that the business process for the object “business trip” 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 “Travel” object:



Open the form of the “Trip” object, go to the “Form Properties” section, add a file with the script, and add the updateProcessStep method in the “Event Handler” block.
The script itself for automatic status update 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<msg.d.results.length;i++) { if(stageStatus.toLowerCase() == msg.d.results[i].StageName.toLowerCase()) nextStageId = msg.d.results[i].ProcessStageId; } if(nextStageId != null) { Xrm.Page.getAttribute("stageid").setValue(nextStageId); Xrm.Page.data.entity.save(); } } }); } 


Conclusion


The task set by the Customer is completed, the goal is achieved. The business process and the sequence of business process operations work together. As part of the business process, the automatic switching of the stages of the sequence of operations of the business process is provided, and the visibility of the process on the form is ensured by the visual support of the schedule.

In this simple example, we tried to show how to expand the functionality of working with different types of processes in Microsoft Dynamics CRM 2013 and, perhaps, make the system more comfortable for end users.

Source: https://habr.com/ru/post/249577/


All Articles