Scenario Overview

Note : This Article is for pre version 9 of CRM , since then Microsoft has given the Process Stages its own Entity. 

In this scenario we had a business requirement to ensure that at least 1 Decision Maker stakeholder has been assigned to an Opportunity before allowing the Opportunity to the Develop step.

North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • A formula of type Validation is created
  • It is configured so that it executes each time the Process Stage field changes on the Opportunity entity
  • On execution it runs a FetchXML query that checks the Process Stage is Develop
  • It then uses another FetchXML query that checks if there is a Stakeholder with a role of Decision Maker connected to the Opportunity
  • If any approved Stakeholders are found it allows the Opportunity Stage to progress to the Develop stage
  • Otherwise it displays an error message to the user

Sample Error Message

North 52 Formula

North52 Decision Suite Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type Validation, mode Server Side, event: Create & Update
  • Set the Source Entity to Opportunity
  • Set the Source Property to Process Stage
  • Copy and paste the formula below into the N52 Formula 
  • Create the 2 FetchXML queries and copy in the code into them
  • Click Save
  • You are now ready to test


Iftrue (FindValueFD( 'GetCurrentStageName', 'stagename', '?',true)= 'develop'  and
                                      'Decision Maker',
                                       true) ) ) = 0,                          
      'You cannot go to the develop stage without at least 1 decision maker stakeholder!'

FetchXML : GetCurrentStageName

<fetch count="50" >
  <entity name="processstage" >
    <attribute name="stagename" />
    <filter type="and" >
      <condition attribute="processid" operator="eq" value="@processid@" />
      <condition attribute="processstageid" operator="eq" value="@stageid@" />


<fetch count="50" >
  <entity name="connection" >
    <attribute name="connectionid" />
    <filter type="and" >
      <condition attribute="record1id" operator="eq" value="@opportunityid@" />
      <condition attribute="record2roleid" operator="eq" value="{0}" />

Wizard - FindValueFD

Please see below the wizard you can use to create the FindValueFD() function call used in this formula. 

Note you will need to create the Fetch Xml GetCurrentStage beforehand. 

Did you know?

North52 TestShield allows rigorous regression testing of your Dynamics 365 system in-sprint

As well as being scheduled, or triggered from build pipelines, TestShield automated tests can be triggered manually for a quick mid-sprint regression test. This allows for quick testing of alternative ways to implement a requirement and measure the impact on existing processes. 

It's quick to clone an existing test and try variations without affecting the original test set up too.

Learn how TestShield can help your Dynamics 365 project