Views:

Scenario Overview

In this scenario you need to implement a business rule that will change the business process flow &  stage on the opportunity entity when the estimated revenue of the Opportunity is set to less than $1,000. 

You can use this example to perform either of the two actions,

  • Change the Business Process Flow & the Stage
  • Just change the Stage of the current Business Process Flow

 

Note1 : If you are using CRM 2015 Update 1 or higher you will need to also set the field named traversdpath in order to get this to work correctly
Note2 : If you are using CRM 8.0+ or above do not use this KB article as it no longer applied. Instead look at these  KB articles ,

https://support.north52.com/knowledgebase/article/KA-01127-dynamics-crm-365-xRM-Formula-122-Automatically-Change-Business-Process-Flow-Stage-based-on-User-Input/en-us

https://support.north52.com/knowledgebase/article/KA-01938-dynamics-crm-365-xRM-Formula-171-Sample-Automatically-change-Business-Process-Flow-stage-based-on-field-value/en-us


North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • Use the FindValue() function to lookup the guid of the required business process flow
  • Use the FindValue() function to lookup the guid of the stage 
  • Use the UpdateRecord() function to update the opportunity record with the 2 guids from above
  • The formula type is set to Process Genie so we can call the formula from a wortkflow 

North52 Decision Suite Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type 'Process Genie'
  • Set the Source Entity to 'Opportunity'
  • Copy & paste the formula below into the formula description field & click save
  • Create a new workflow within CRM where you add a condition to check that the estimated revenue is less that $1,000.
  • If it is less than $1,000 then use the custom workflow activity 'N52 Process Genie' to call the formula by passing in the short code from the formula. See the screenshot below for how this is setup.
  • You can now test this on the Opportunity entity.

Formula

UpdateRecord( 'opportunity',                    
                         [opportunity.opportunityid],
                         SetAttribute('processid',     
                                               FindValue('workflow',                      
                                               SetFindAnd('name', 'statecode'),           
                                                SetFindAnd('QuickOpportunityProcess', '1'), 
                                                'workflowid' ) ),              
            
                         SetAttribute('stageid',                                           
                                      FindValue('processstage',                            
                                      SetFindAnd('processid', 'stagename'),                                           
                                      SetFindAnd(FindValue('workflow', SetFindAnd('name', 'statecode'),
                                      SetFindAnd('QuickOpportunityProcess', '1'), 
                                                 'workflowid' ), 'Qualify'), 'processstageid' ) )                  
                         )

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