Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Business Process Flows data model in Dynamics 365 Online

Posted on by 4,257

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)?

*This post is locked for comments

  • SB1982 Profile Picture
    SB1982 10 on at
    RE: Business Process Flows data model in Dynamics 365 Online

    Hi Mohamed,

    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)

    community.dynamics.com/.../how-can-i-work-out-the-time-spent-in-each-stage-of-a-business-process

    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!

  • Verified answer
    M I Mostafa Profile Picture
    M I Mostafa 4,257 on at
    RE: Business Process Flows data model in Dynamics 365 Online

    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);

    More details in this MSDN article:

    msdn.microsoft.com/.../dn481586.aspx

    Workflow entity definition:

    msdn.microsoft.com/.../mt622427.aspx

    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!

  • Verified answer
    M I Mostafa Profile Picture
    M I Mostafa 4,257 on at
    RE: Business Process Flows data model in Dynamics 365 Online

    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:

    Name

    Type

    Details

    clientdata

    Edm.String

    Description: Step metadata for process stage

    Display Name: Client Data

    Read-only property

    owningbusinessunit

    Edm.Guid

    Description: Select the business unit that owns the record.

    Display Name: Owning Business Unit

    Read-only property

    primaryentitytypecode

    Edm.String

    Description: Primary entity associated with the stage.

    Display Name: Primary Entity

    processstageid

    Edm.Guid

    Description: Shows the ID of the process stage record.

    Display Name: Process Stage

    stagecategory

    Edm.Int32

    Description: Select the category of the sales process.

    Default Options:

    0 : Qualify
    1 : Develop
    2 : Propose
    3 : Close
    4 : Identify
    5 : Research
    6 : Resolve
    7 : Approval

    Display Name: Stage Category

    stagename

    Edm.String

    Description: Type a name for the process stage.

    Display Name: Process Stage Name

    versionnumber

    Edm.Int64

    Description: Version number of the process stage.

    Display Name: Version Number

    Read-only property

    I will now try to test out the values that I can get from this entity.

    More details in this MSDN article:

    https://msdn.microsoft.com/en-us/library/mt790421.aspx

    Hope this helps someone!

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Business Process Flows data model in Dynamics 365 Online

    Hi Mohammed,

     Not sure about the DB table.. There is processstage entity. You can try this kind of webapi request to see what's in there:

    https://<URL>/api/data/v8.2/processstages

     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.

  • Suggested answer
    M I Mostafa Profile Picture
    M I Mostafa 4,257 on at
    RE: Business Process Flows data model in Dynamics 365 Online

    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?

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Business Process Flows data model in Dynamics 365 Online

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans