Invalid stage transition. Transition to stage {0} is not in the process active path.

Introduction

With latest release of Dynamics 365, Microsoft has restricted skipping BPF stages and throws above error. When we try to change BPF stage programmatically and if we skip any BPF stage, then user will get above error.

Understand the error with the help of an example

Let’s say we have below Business Process Flow on Opportunity.

sample BPF

With D365, only below transitions are allowed.

  1. Qualify to Develop
  2. Develop to Propose
  3. Propose to Close

Below transitions are not allowed.

  1. Qualify to Propose
  2. Develop to Close
  3. Qualify to Close

How my earlier code (prior to D365 release) worked and suddenly stopped working?

Before D365 release by Microsoft, the above scenarios were considered as unsupported and there were no restrictions forced by Microsoft. Hence our code used to work in these unsupported scenarios as well. With D365 release, Microsoft has restricted these unsupported scenarios and users will start receiving the error with same code.

How have I come to this conclusion?

  1. I got the error log file with error code and same error code (-2146885629) is now available in SDK (you can search in CHM file).

SDK Error Code

  1. I raised a support ticket with Microsoft and as per confirmation from MS Support, it has turned out to be by-design. I received below response from MS Support Team.

Reply from MS Support

Note: Even though Microsoft has mentioned Environment as CRM Online, as this is by-design in D365, it applies to CRM On-premise deployments as well.

Summary/Resolutions

  1. After thinking about these unsupported scenarios, it makes sense to use logical branching to skip the stages if needed and if not, then we should follow the path mentioned in BPF.
  2. The resolution to this issue can be programmatically iterate the record through all the stages or use conditional branching in BPF.