Using TraversedPath with Branching Business Flows

I recently ran into an issue with Opportunity records and branching Business Process Flows (BPFs) where all the stages were being displayed on the record, instead of what stages the record had gone through. The solution was interesting and I’d like to share the issue and resolution that I came up with.

Problem

The scenario I was working with involved using an external SQL Server Integration Services (SSIS) package that was creating new Opportunity records that were associated with a branched BPF in Dynamics 365. This external process would create the opportunity record and attempt to set the current stage to one of the stages in a particular branch. This was being done by setting the StageID field to the GUID of the stage that I wanted to make active.

The problem was that when viewing the created opportunity record, the BPF would display ALL the stages from both branches (I had 2 separate branches). Obviously, this was not desirable and was very confusing.

Resolution

After analyzing the fields in Dynamics 365 for the opportunity record I had created, it turns out the reason why this issue arises is due to a field on the Opportunity entity called TraversedPath. This field is a comma-separated list of GUIDs that represents the BPF stages the opportunity record “traversed” through. I was not setting this field at all when creating the opportunity record, and therefore Dynamics 365 was displaying all the BPF stages from both branches (due to no entry in this field).

Once I modified my SSIS process to grab all the BPF stages I wanted the opportunity record to traverse through and set the TraversedPath field, the BPF stages (for the specific branch) were set and displayed properly.

I hope this article helps others in quickly determining the cause of the Business Process Flow issue I ran across.

Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: