Loading...

Dataverse workaround wrong Autonumber Seed during Deployment

Dataverse workaround wrong Autonumber Seed during Deployment
Dataverse workaround wrong Autonumber Seed during Deployment David Uhlmann Sat, 11/04/2023 - 16:31
Body

Dataverse workaround wrong Autonumber Seed during Deployment

Have you ever encountered a weird issue while working with autonumber fields in your solutions? You might have noticed that when deploying them to different environments, the starting value ("seed value") sometimes resets to 1000, despite your efforts to change it. I recently faced this challenge and reached out to support for a solution. In this quick guide, I'll share a workaround that you can use until the seed value becomes solution-aware. Stay tuned for a simple trick to address this problem whenever it occurs. To be clear this is a workaround and not a long term solution. Lets hope this issue goes away soon which would make this article not relevant anymore.

First things first, let's dive into setting up a DEV environment. I've created a basic solution and table named 'Cars'. Our goal is to convert the 'Primary Name Column' into an autonumber field. However, we want this auto number to start from a specific value - let's say 10,000. This approach is essential because our client already has a substantial inventory of cars, and we aim to improve the data migration process later down the road to minimize any additional problems - that (if we are honest with ourselves) come anyways as with every data migration. Let's proceed with this adjustment to ensure a better transition for the client:

Dataverse workaround wrong Autonumber Seed during Deployment

Now, this is all good. If we create a record in DEV it gets the intended number:

Dataverse workaround wrong Autonumber Seed during Deployment

Now, we throw this solution into a pipeline, which, by the way, you should always do to avoid manual deployments whenever possible, and deploy it to a TEST environment to see our auto number field. What do we see? Well, we see that Power Platform changed the Autonumber back to the default seed value of 1000:

Dataverse workaround wrong Autonumber Seed during Deployment

After contacting support, I was told that seed values are not solution-aware as of now (November 2023), meaning you cannot deploy them easily. This might seem weird because you might think that when you configure the column, the seed value is somehow also included in the solution, but it's not. There are methods to do that, but most of them are unsupported and/or break fundamental architectural rules. So, let's demonstrate an easy method to change this. First, go to the default solution in your TEST environment, then to the respective table and field, and change the seed value there

Dataverse workaround wrong Autonumber Seed during Deployment

This will, of course, create an unmanaged layer inside your managed solution. Next, we jump back to our managed solution and remove the respective layer. This is important because the order of execution will otherwise always show this layer, and this is potentially not what you want for later deployments

Dataverse workaround wrong Autonumber Seed during Deployment

There you can go on and remove the unmanaged layer:

remove unmanaged layer

And after completing this step you should see the "correct" seed value in your app, in our case the autonumber for the cars:

Dataverse workaround wrong Autonumber Seed during Deployment

Of course, this is a workaround and is classified here as a 'Trick.' However, as long as seed values are not solution-aware, which I hope will soon happen, it is a possible way to input the correct values into your target environments if you have to use custom formats for your numbers.

Dataverse workaround wrong Autonumber Seed during Deployment

Published on:

Learn more
Featured Articles | Dynamics Chronicles
Featured Articles | Dynamics Chronicles

Welcome to our blog, the content is entirely dedicated to Microsoft Dynamics 365, CRM, Power Platform, Common Data Service (CDS) but also Azure. Follow us !

Share post:

Related posts

Microsoft Copilot / AI – A day in the life of a power platform developer

AI, particularly Microsoft Copilot, has significantly impacted daily work, enhancing productivity and streamlining processes. It has been used...

19 hours ago

Announcing Power Platform Well-Architected

Announcing Power Platform Well-Architected, a comprehensive framework designed to help you maximize the value of your investments in modern ap...

21 hours ago

Power Platform – May 2024– Screenshot Summary

The Power Platform May 2024 Monthly Community Call was packed with exciting updates and demos. The highlights of this call included presentati...

1 day ago

Effectively manage site security from the Power Platform Admin Center

Learn how to effectively manage site security with the Power Platform Admin Center in this informative post. Security is a top priority for an...

1 day ago

Simplify administration with Environment Groups in Power Platform

If you're looking for an easier way to manage and administer your Microsoft Power Platform environments, then this blog post is for you. Here,...

2 days ago

Power Platform – Environment groups and environment routing general availability

The Power Platform is set to improve its governance capabilities through the release of Environment groups and improvements to Default Environ...

2 days ago

Microsoft 365 & Power Platform Call (Microsoft Speakers) – May 14th, 2024 – Screenshot Summary

This post provides a summary of the May 14th, 2024 Microsoft 365 & Power Platform community call, featuring updates and demos from Microsoft s...

2 days ago

From Traditional Coding to Power Platform Prowess: The Developer's Guide to Innovation and Adapta...

Join James Weaver in an insightful discussion, where he delves into the intersection of traditional coding and low-code development, highlight...

3 days ago

Power Platform admin center – Power Apps maker welcome content is now Generally Available

Power Platform admins now have the ability to customize the welcome content that Power Apps maker portal users see when logging in, thanks to ...

3 days ago

Power Pages activity logging | Power Platform Shorts

Looking for a way to enhance your Power Platform admin skills? Check out the latest video in the "What's New" series, which explores the conce...

3 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy