Scenario Overview

You need to generate an AutoNumber for the Account entity within the Account Number field. The format of the AutoNumber needs to meet the following requirements:

  • Have a prefix of "Acc-"
  • Followed by a fixed nine-digit number left padded with zeros
  • A number starting at 1,000 incrementing by 1 each time a new Account record is created 

N52 Formula Manager Solution

Formula Managers solution to this is to build a formula which will,

  • Execute on the create of Accounts within the system
  • Have a formula that generates the auto number requirements
  • Have the formula place the result of the formula into the Account Number field of the Account entity 

Formula Manager Steps

The following set of steps outline how to create this Formula

  • Create a new Formula with Dynamics CRM taking the default name for now
  • Set the Formula Type field to 'Auto Number'
  • Set the Auto Number Field to 1,000. This is the starting point for the auto number generation
  • The Pipeline Event is set automatically to 'Create'. This means the formula will only execute when a record is created
  • Set the Source Entity to "Account". This means the formula will only execute when an Account record is created
  • Set the Source Property to 'Account Number'
  • The Target Entity  is automatically set to 'Account' for us
  • Set the Target Property field to 'Account Number'
  • Copy and paste the below into the Formula Editor
  • Click Save, you are now ready to test. 



'Acc-' + PadLeft(ToString(AutoNumber([account.accountnumber]+1)),9,'0')

Did you know?

Decision Tables Simplify Complex Logic

Decsion Tables allow you manage complex business logic without code.  Key features include:

  • Simple visualization in a compact table format
  • Promotes grouping of rules in a single table
  • Business logic can be controlled by domain experts

A Decision Table represents multiple related business rules by using conditions, actions and data values in a spreadsheet-style table. The Decision Table uses columns for the conditions and actions of the rules and rows to represent the associated data values.

Learn more about Decision Tables