Create auto number field

Creating a auto number field has always been part of a project somewhere along the line and now we can create them using Dynamics 365 SDK without having to write custom plugins.

At the time of writing the post we can only create auto number fields using the SDK and not from the UI but i am positive we will see the feature in the UI in the near future.

Currently supported tokens

  • Static String
  • DATETIME:[format] e.g: yyyyMMddhhmmss
  • SEQNUM:size
  • RANDSTRING:6

Example:

The following examples show how to create a new auto-number attribute named new_SerialNumber for a custom entity named new_Widget which will have a value that looks like this: WID-00001-AB7LSFG-20170913070240. Using the Organization service with SDK assemblies CreateAttributeRequest and StringAttributeMetadata classes:

 

Microsoft Docs used click here