Tuesday, 10 August 2021

Create auto number fields in Dynamics 365

Dynamics 365 for Customer Engagement auto-creates unique ID’s for certain records types out of the box, for instance orders, cases, and invoices. But…Have you ever had the need to ‘auto number’ records of an entity in Dynamics 365 where the system doesn’t assign these numbers out of the box?
I’ve had customers that wanted leads and opportunities to have unique id’s so that these records would be easier to find in the system. I also had a customer that wanted to assign these unique id’s to contact records. So what to do? There are several ways this could be accomplished, we could write a plugin or even use a real time workflow for this, but putting the work flow together was very complicated, and I would have to create a new workflow for each entity that I wanted to auto number!

Yesterday I was playing around with the new form editor for Dynamics 365 and I noticed the ability to turn a text field to an auto number field! WHAT?
Yes you heard that right, you can change any text fields to an auto number data type, and the system will start auto numbering this field! This means we can change any existing text fields to an auto-number data type or add our own custom text field with the auto number data type to the application.

The classic interface does not support creating auto number fields, so we have to use the new form editor which can be accessed through make.powerapps.com. (Under Data, select Entities, then select the entity you are configuring. Navigate to fields to change an existing text field.)

There are a few predefined auto number types available when configuring a field as an auto number data type:

  • String Prefixed – With this option the number will have a prefix before the actual number. (I.E ACCOUNT-100, ACCOUNT-101, etc.) The number itself will automatically increment for each record.
  • Date Prefixed – This option will prefix the number with a formatted date, which will will reflect the current date and time a record was created. (I.E 2019-25-05-100, 2019-25-05-101, etc.) There are different date formats users can choose from.
  • Custom – There is an option to customize the formatting of the auto number field, examples are available here

Prefix
When choosing the String Prefixed Number as the auto number type, users can set their own prefix. This is the part that shows up before the number. (I.E ACCT-100, ATTC-101)

Date Format
When choosing the DatePrefixed Number as the auto number type, users can choose the date format. This is also the part that shows up before the number. (I.E 2019-16-08 -100, 08-16-2019-101)

Users have the ability to preview what the auto number will look like when selecting these options.

Minimum Number of Digits
This option shows the minimum number of digits your auto number will contain. Keep in mind that as the (auto) numbers increase, they may become longer than what what has been selected in the minimum number of digits option. So for example if your minimum has been set to 3, once the auto number hits 999, the next number will be 1000, which is 4 digits instead of the minimum of 3.

Seed Values
The seed value of an auto number field is the number that is used to start the numbering. So if you wanted the auto numbering to start at number 500 for example, the seed value should be 500. The next record will then be 501, then 502, etc. Keep in mind that there is a default setting for the seed value of 1000, but this can be changed to any number you want.

I hope this article helped in simplifying the auto number process in your Dynamics 365 instance! Tune back in next week for another article!

No comments:

Post a Comment

How to Trigger a Microsoft Flow from a Custom Button in Dynamics 365

  When using Microsoft Flow the out-of-the-box button is nested under the ‘Flow’ section and is not easy to find nor is it customizable. Tri...