Autonumbering in Dynamics 365 CRM v9 with the new PowerApps Feature

Jordan Hohepa, 26 July 2019

With Dynamics 365 there has sometimes been a need to have some sort of autonumbering field on specific Entities. Autonumbering has been available out of the box for a limited number of Entities and the setting for this is available via Settings -> Administration -> Autonumbering. The screenshot below shows a list of the Entities this is available for and shows how limited the customizability of this is. With the new wave of PowerApps functionality this has opened up a new trove of autonumbering functionality which I will go through in this blog.

image

The first step would be to open the PowerApps Maker Portal in a browser of your choice by following this URL: https://make.powerapps.com. Once here and logged in as your User which is connected to the Dynamics 365 Instance you wish to update, you need to ensure that you have selected the correct environment in the header navigation (the environment you wish the new field to be available in), expand ‘Data’ and select ‘Entities’. You should see a list of Entities and selecting one will show a screen similar to the below screen, which in my case was the Account Entity.

image

From the above screen you can select ‘Add field’ and the screenshot below will be fly out from the right side. This field add screen will let you set the Name and Type of your field while letting you customize the field. For this blog we’ll be using the ‘Autonumber’ Data Type.

image

The Autonumber field has three types. The first is a String prefixed number which is shown in the above screenshot with an optional Prefix, Minimum number of digits and a Seed value to set which value the field should start at. Next is a Date prefixed number, which is the same as the previous option but with the Prefix being a range of different Date Strings like ‘2019-07-07’ or ’07-Jul-2019’.

image

The last Autonumber type is Custom, which lets you choose to add and combine sequential, date or random strings together to create your own autonumbering format. For this example I will add a simple 4 digit number using the Custom option with the seed set to 1,000. As you can see in the screenshot below a preview of the next available numbers in the sequence is shown and an Advanced options dropdown with the ability to add a Description, Max Length and IME Mode.

image

Autonumering isn’t only limited to creating new fields but can also be made available for existing fields. The screenshot below shows an existing Single Text Field which was created in a classic Dynamics 365 Solution. The Data type was able to be updated to an Autonumber type even though the field already existed. For this example I selected String prefixed number, adding a Prefix named ‘EXIST’ and having a seed value of 2000.

image

Now once I put them on the main Account form I can create a new account. The screenshot below shows the two autonumbering fields being populated once the record has been created with the first being set to 1000 and the second being set to EXIST-2000.

image