Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
In the latest Dynamics 365 release (version 8.2), Business Process Flow data model has changed and now each BPF is created as a separate entity. Does anyone know where does the mapping between Stages and Steps of Business Process Flows are stored in the backend data model (i.e. which DB table)?
A Business Process Flow is a type of process, so is stored in the workflow entity (and workflowbase SQL table). The stages and steps are all defined in the Xaml definition in the xaml column, which is an XML document
Thanks David. Just to confirm, you are saying that the Business Process Flow design including stages and steps are still stored in XAML definition under the Workflow entity XAML column.
I would also add that I found out that new data model means that every instance of each Business process flow is stored as a record under the Business Process Flow own entity.
Anyone has any more information to add to this?
Not sure about the DB table.. There is processstage entity. You can try this kind of webapi request to see what's in there:
It'll give you all the process stages and steps per stage, it seems.
Every process flow entity, in turn, will have a lookup to the process stage.
Many thanks Alex. This is really helpful. I think this might be the entity I was looking for.
Here is what I found:
Process Stages Entity contains: Step metadata for process stage (Client Data). It also contains stage Category (Qualify, Develop, Propose, etc.) and also Stage Name.
Here is a table of the Entity Properties for SDK calls:
Description: Step metadata for process stage
Display Name: Client Data
Description: Select the business unit that owns the record.
Display Name: Owning Business Unit
Description: Primary entity associated with the stage.
Display Name: Primary Entity
Description: Shows the ID of the process stage record.
Display Name: Process Stage
Description: Select the category of the sales process.
0 : Qualify1 : Develop2 : Propose3 : Close4 : Identify5 : Research6 : Resolve7 : Approval
Display Name: Stage Category
Description: Type a name for the process stage.
Display Name: Process Stage Name
Description: Version number of the process stage.
Display Name: Version Number
I will now try to test out the values that I can get from this entity.
More details in this MSDN article:
Hope this helps someone!
I found some additional information (thanks for the tips above from David and Alex).
The Workflow entity stores a business process flow definition. So once the entity is created, it is always in Draft state and its definition is stored in Workflow entity. XAML property is where the definition is stored and is mandatory/required.
Once you activate a business process flow definition (by changing the state of the corresponding Workflow entity record), a custom entity with the following name is automatically created to store the activated business process flow instances: "<activesolutionprefix>_<uniquename>".
Here is the code to retrieve active path for a process and the current and next stages on the process:
// Retrieve the active stage ID of in the active process instance
_activeStageId = new Guid(activeProcessInstance.Attributes["processstageid"].ToString());
// Retrieve the process stages in the active path of the current process instance
RetrieveActivePathRequest pathReq = new RetrieveActivePathRequest
ProcessInstanceId = _processOpp2Id
RetrieveActivePathResponse pathResp = (RetrieveActivePathResponse)_serviceProxy.Execute(pathReq);
Workflow entity definition:
Hope this helps anyone trying to get better understanding of Business Process Flows new Model (version 8.2 December 2016 release. This community discussion is now worth a blog post!
Thank You for the details about the new data model for Business process flows.
I have a requirement from my customer to calculate the duration of sales process stages each user is going through.
eg for all leads qualified as opportunities in 2017: how long were they in Qualify, Discovery, Execution stages etc by owner.
I figured out that achieving this requirement was pretty straight forward to implement in CRM v8.1 or earlier. (below link)
However from CRM v8.2 onwards, like you pointed out that there has been data model changes in the way the business process works internally...it seems that each BPF spawns a new custom entity..
I was planning to add a custom entity which could track the stage start and end times using a workflow.
However to track the time duration for each stage, I need to know when to trigger my workflow which should ideally happen whenever the BPF starts or stage change happens.
Any ideas, suggestions welcome!