Scenario Overview
In this scenario we will show you how to set up an AutoNumber formula on an Opportunity entity that only fire only when the Opportunity  reaches a specific stage in the Business Process.
The requirement is that we only want to set the AutoNumber when the Opportunity reaches the Develop stage. For this example I have created a custom field on the Opportunity entity called Opportunity ID that will store the identification autonumber.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- A Formula of type 'AutoNumber' is created on the Opportunity entity
- Event is set to 'Update'
- Source Property is set to 'Process Stage'
- The Target Property is set to 'Opportunity ID'
- The DoesNotContainData() function ensures that the field doesn't get updated again if the Opportunity is set to the Develop stage on more than 1 occasion during its life cycle.

Note: You can find the Process Stage IDs via the Source Tab. Expand Related (N:1) and then processstage (stageid)
 
North52 Decision Suite Steps
The following set of steps outline how to create this Formula
- Create a formula of type 'AutoNumber' on the Opportunity entity
- Set the Source Properties as 'Process Stage'
- Set the Target Property as 'Opportunity ID'
- Copy and paste the formula below into the formula canvas
- Save and test!
Formula
If([opportunity.stageid.stagecategory.?] =  1 and
  DoesNotContainData(FindValue('opportunity',
                               'opportunityid', 
                               [opportunity.opportunityid],
                               'new_opportunityid',
                                '?', true))  ,
  
  /* True */
  'Opp-' + PadLeft(ToString(AutoNumber([opportunity.new_opportunityid] + 1)),9,'0'),
  /* False */
  'NoOp' 
) 
Wizard - FindValue
Please see below the wizard you can use to create the FindValue() function call used in this formula. 
Note to find the value for Equals Value , you will need to go to the Source tab and find Opportunity.  
 
 
		
