web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Model creation duplica...
Finance forum

Model creation duplicate id's

(0) ShareShare
ReportReport
Posted on by 1,871

I am currently working on an implementation (v10.0) with 6 developers all located in different countries/cities and last week we had two developers get a duplicate id on new model's descriptor files created in our development branch for TFS/AzureOps. They can manually correct them in the descriptor file(s) but is that the best course of action/Does it cause more dupe id’s down the road? Any suggestions on preventing this? What number should we even update it to? The exact scenario we are facing is dev1 creates a new model with id 123 and then 2 weeks later dev 2 creates a new model but it also has a id 123 so when that project is checked in and other dev’s pull down the latest dev branch it stops our development.

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Model creation duplicate id's

    one of the way is to create a new package again, sync to VSTS and all should import their work

  • Verified answer
    Joris dG Profile Picture
    17,775 on at
    RE: Model creation duplicate id's

    Part of the algorithm that creates the IDs is based on existing model IDs on your system. So if one dev creates a new model, checks it in, the other dev syncs the code and creates theirs, you should never get duplicates.

    That said, yes you could technically still run into duplicates with ISVs or technically even Microsoft code. It's a known problem and one of the great challenges of 2019 for Microsoft to solve. :-)

    One thing to note is that you want to be careful about how many models/packages you create. If the developers are all part of the same team and use the same source control, there likely is very little reason to have them work in their own models. In fact, it will likely end up causing you a headache down the line. Unless you have clear needs that require you to separate the code into separate packages (i.e. assemblies), I would avoid it!

  • adam260 Profile Picture
    1,871 on at
    RE: Model creation duplicate id's

    Thanks for the info. If I understand you correctly when generating the id it will take a look at the base package and then any extension models and then do a dupe check? So we wouldn't have ran into the issue if all devs always do a get latest on the dev branch before creating a new model on each of their machines?

    Could you elaborate on what you mean by the following "One thing to note is that you want to be careful about how many models/packages you create. If the developers are all part of the same team and use the same source control, there likely is very little reason to have them work in their own models. In fact, it will likely end up causing you a headache down the line"

    (currently working for an end-user)

    I configured it per the Microsoft readme.txt on how to set this. Has something changed as we set this up during v7.3 but are on v10.0? Currently each dev has their own box and any time a new enhancement is started we create a new model and add it to the company's deployable package.

    Then when it hits the build server it generates a single deployable run time.zip but within it our company code and each ISV has its own .nupkg. So I'm a little confused on what you are suggesting.

    Example tree structure:

    $/Project/Trunk/Main/Metadata
    +---MyMainModule (Deployable package)
    |   +---Descriptor
    |   |       MyFirstModel.xml
    |   |       MyOtherModel.xml
    |   |
    |   +---MyFirstModel (Enhancement #1)
    |   |   +---AxClass
    |   |   |       MyClass.xml
    |   |   |
    |   |   \---AxTable
    |   |           MyMainTable.xml
    |   |
    |   \---MyOtherModel (Enhancement #2)
    |       \---AxForm
    |               MyOtherForm.xml
    |
    \---ISV #1
    |   +---Descriptor
    |   |       MyTestModel.xml
    |   |
    |   \---ISVModel1
    |       \---AxClass
    |                MyTestClass.xml 
    \---ISV #2
        +---Descriptor
        |       MyTestModel.xml
        |
        \---ISVModel2
            \---AxClass
                    MyTestClass.xml
    


  • Suggested answer
    Joris dG Profile Picture
    17,775 on at
    RE: Model creation duplicate id's

    Yes, if they always sync you shouldn't have this issue (unless of course they literally create the model at the same time). But I think you got the idea :-)

    Oy, I never noticed that "readme" would suggest a model for each enhancement. I will immediately send out a code review to remove that. Don't do that, it will become a nightmare to manage. If you have AX2012 experience, I would equate this to you using a different layer for each customization you're doing.

  • adam260 Profile Picture
    1,871 on at
    RE: Model creation duplicate id's

    Do you have any documentation on what MS is now recommending along with switching from the current model?  It has actually been seemless so far but we are only 30 enhancements into an implementation with 2-3 ISV's installed as well. The bad part is this is what MS was recommending with 2012 just no one ever followed it.  With a pure extension model it makes more since than 2012 as we should be developing each enhancement just like an ISV would so its more independent and flexible and specially since the layers are gone.

    The core app seems to be getting a ton of cool stuff but seems like everyone forgets about the dev's (*cough VS 2015*).  I do appreciate the heads up on how its generating the model id though. Should save us some headaches down the road.

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at
    RE: Model creation duplicate id's

    Well, every model you create is technically a new layer in your package - assuming you create your models in the same package every time. Even in 2012 this wasn't practical at all, since every "element" can only exist in one model per layer (so if two customizations touch the same field - the field can only exist in one model). In D365, the field will exist in model1 and model2, but one model technically is over-layering the other. Now, the over-layering is granular down to the property (so unless the two customizations change the same property, things will likely merge just fine) but for example an code method - you would have to start merging code between "models" (i.e. layers) if the lower layer (model) gets updated. And if you want to change this code later to all be in one model, you'll have one hell of a time to start copy/pasting properties and what not.

    Also, what purpose would this serve? In AX2012 you could arguably export the model and import it somewhere else (albeit error prone considering elements could be missing etc.). In AX7, the models, since they are layers, get flattened into one version and one assembly. There is no compilation benefit (in fact, many models in the same package will probably hurt compiler performance), and there is no deployment benefit (since you deploy the  whole compiled package). From a developer perspective there is no benefit either, considering what I said above.

    If you create an entirely new package for each thing that's not a good plan either. Over time it will become a nightmare of event handlers and extensions in multiple places with no overview of what's where. Maintenance and debugging tasks will become very difficult.

    Hope that helps frame a few things.

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at
    RE: Model creation duplicate id's

    And forgot to mention. There is a big investment in dev tools right now.

    See docs.microsoft.com/.../developer-tools-application-lifecycle-management

  • adam260 Profile Picture
    1,871 on at
    RE: Model creation duplicate id's

    Hopefully we see VS 2019 soon.

  • adam260 Profile Picture
    1,871 on at
    RE: Model creation duplicate id's

    If I get what you are saying is I should create a generic D365FO model for our company and then each dev should just create a new solution and then tie it to a single model via the solution properties? Just like we did in 2012 where I would setup a company model on the cus layer and then just deploy that?

    If I create a base object (lets say new table) in solution 1. In solution 2 do I add the actually new table or do I create an extension?

    I like what you are saying and it makes more sense it just conflicts with what MS has pushed out and what every VAR/other d365fo dev I have talked to is suggesting/done. But I’m only 14 months into D365FO (starting with 7.3) so my scope is limited on the new architecture specially since it is changing so rapidly. If that is in fact the case do you know of a way to merge models to get? or some whitepapers on the difference so if I manually did this I can justify the hours it would take.

    Is this is the setup you are suggesting?

    $/Project/Trunk/Main/Metadata
    +---Company123Package
    |   +---Descriptor
    |   |       Company123Model.xml  
    |   +---Company123Model
    |   |   +---AxClass
    |   |   |       Enhancement1Class.xml
    |   |   |	Enhancement1Class_Extention.xml
    |   |   |       Enhancement7Class.xml
    |   |   \---AxTable
    |   |           Enhancement4.xml
    |
    \---ISV1
        +---Descriptor
        |       ISV1.xml
        |
        \---MyTestModel
            \---AxClass
                    ISVClass.xml
    


  • Suggested answer
    Joris dG Profile Picture
    17,775 on at
    RE: Model creation duplicate id's

    1) Yes that is what I would suggest.

    2) Since it's in the same package/model you would just keep modifying the base object in your code. You own it so there's no point in creating extensions, just modify the object itself.

    3) Other than the readme.txt I'm not sure what we would have pushed out that would suggest models per customization? I genuinely would like to know so I can modify/update that. There are VERY few customers that have a model per customization, and anytime I see it I tell them to work on undoing that. If you go through an implementation like this most people realize fairly quickly that it's unsustainable, so any partners/devs doing this likely don't have much D365 experience. You may want to expand your X++ circle of friends :-)

    I'm not aware of anything documentation on how to merge models. This is not something you can provide a step-by-step doc for, detailing every possible type of object and possible type of issue. Technically it's just a matter of copying the XML files from one place to another. The issue will be any code that is over-layering a model in the same package (which I'm not sure if you have or not) or merging multiple extensions on the same object to simplify things into only 1 extension. If you don't have much of these conflicts merging the models wouldn't be much effort.

    And finally, yes, that setup is what virtually everyone uses. I've updated the readme.txt which will go into PU28 - thanks for pointing that out.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans