In PowerApps, Dynamics 365 and the Common Data Service, we have the option to use a field type called AutoNumber, which automatically updates the data in the field to a set format and increments a number in the field. Let’s look at how to do this.
Log into PowerApps at https://powerapps.microsoft.com/en-us/ and select your PowerApps environment:
Let’s add an autonumber field to our Account entity. Go to Data->Entities and select the Account entity:
Click Add field:
You will see the pane open:
Clicking on the Data Type field gives us options for setting the data type, including Autonumber:
Enter a Display Name for the field. We can see in expanding the Autonumber type, we have String prefixed number, date prefixed number and custom:
Let’s use String Prefixed and enter TEST- as the prefix. The Seed value is the starting number that will be incremented. So in our case, our field looks like TEST–1000, TEST–1001 etc:
Advanced Options allow us to set the Description, Max Length and IME Mode (for international characters):
If we decided to use a Date Prefix, we would get something like below, with the option to choose the date format:
And with the Custom format, we can define our own format (see more for defining these):
We will continue with the Text format example. Click OK to save the field.
In the bottom right click Save Entity.
The field is now created. Let’s use it on a form:
Go to Forms and select the Account Main form:
Drag the field onto the form:
In the top right, Save and Publish:
Now, open an App and navigate to the Account form. We see the new field. Enter an Account Name and click Save:
Save the record, and the autonumber field will increment:
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL
Is there a way to dynamically set the prefix? For example, if the account type is a client, set prefix to ACC but if its a vendor, set the prefix to VEN?
Will this for custom entity too? I tried but it is not working.