Views:

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. 

Formula

 

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