Scenario Overview

In this scenario we have a custom field on the Opportunity Form called: All Items Complete. 
This is a locked field with a default value of No.

The business rule should update this field on the Parent Opportunity to Yes only when all child Opportunity Products are set to a Status of Complete. 

North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • A formula of type 'Save To Parent' is created
  • It is configured so that it executes each time the Status Reason field changes on the Opportunity Product entity.
  • On execution it counts all the child Opportunity Product records for the Parent Opportunity
  • It then counts all the child Opportunity Product records for the Parent Opportunity with a status of Completed
  • Finally it compares the counts, if the numeric values are the same then we know all the child records are Completed.
  • If true the All Items Complete field on the Parent Opportunity record is set to Yes.


North52 Decision Suite Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type 'Save To Parent'
  • Set the Source Entity to 'Opportunity Product'
  • Set the Source Property to 'Status Reason'
  • Set the Relationship field to 'opportunityid (opportunity)'
  • Set the Target Property to 'All Items Complete'
  • Copy & paste the formula below into the formula 
  • Replace the value in the formula for desired status reason with the appropriate one by clicking on the Source tab on the left, selecting status reason and then 'Completed'
  • Click save
  • You are now ready to test


         ) = 
           setfindand('opportunityid', 'new_statusreason'),
   , true, false

Wizard - FindCount

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

Note to find the value for Equals Value, you will need to go to the Source tab and search for "opportunity

Did you know?

Automated tests in Dynamics 365 helps with documenting processes

Maintaining automated tests helps you create 'living' documentation of your Dynamics 365 systems, minimizing the potential for frustrating rework.

Building a test validates the requirements, makes it easy to spot ambiguity and incompleteness and can catch defects before they are released. 

As requirements change, tests need to be updated to ensure they continue to validate, thus ensuring the documentation stays up to date.

Learn how TestShield helps automate testing in Dynamics 365