In previous articles, we already discussed and created different models which are mandatorily required for customization. In this article, I am going to explain what a model is and why models are used in d365 projects.
As we know, the complete D365 Finance and Operation developments are based on these four terminologies Package, Model, Project, and Element. So as a developer you need to know processes how to create a model, how to update a model, and how to delete a model.
Here’s a table of contents to help you find your way around:
Table of contents
What is a Model in D365?
A model is a design-time concept. A particular model can contain multiple Visual Studio projects. Therefore, you can say it is a collection of projects and a single project can have all or subset of elements from originating model.
However, the association of a project is only with a single
model. It is basically a unit of development/customization. Metadata for models
is stored locally on an XML file called a descriptor XML. Hence creating a model
is a mandatory thing for any sort of customization.
Suppose you have a requirement for developing or customizing
a payroll solution, so what you will do? in this case, before starting the
project or coding you have to create a model, you need to give a name for the model such as Payroll Model, then
further all your customization or anything associated with this payroll
solution development means any object you are creating as new such as Tables, Forms, EDT, Reports, etc… or extending already existing objects like CustTable,
VendTable or anything will be based on the model Payroll Model.
But here you don’t confuse the d365 model concept with the dot net
c# model concept, that is another concept.
Where is Model Data Stored in D365?
Where is D365 Model Data Stored? In Visual Studio while
we are creating a model or updating a model one new folder is created, and
some files in the AOSService folder, which contains the files to run Microsoft
Dynamics 365 for Finance and Operations. In a cloud-hosted developer machine,
you can look on the C drive, and find your new model folder under C:\AosService\PackagesLocalDirectory\<Your
model Name>
Creating a model in D365
Here I put some basic steps for creating a model in d365
using visual studio, in the next following articles I will show you how to create,
update and delete a model. So how to create a model in d365?
To create a new model, follow these steps:
1. Open Visual Studio as admin.
2. On the Dynamics 365 menu, point to Model management and select Create model
3. Give a model, publisher name, and other values
This is the basic way of creating a model in D365.
Update a model in D365
During the creation of a model, if any reference to any package
is missed then it can be added through the Update Model parameters wizard. Here, I
am trying to add the package Application Suite to the model Sample (created earlier).
Suppose you have created a model, initial time you forgot or not added the reference packaged Ledger, while you are proceeding with project customization, you need to use the EDT object named AccountCategory, so in this case, you must update the model parameters, otherwise what will happen? visual studio will show some errors and you cannot proceed with the project. O in this case you follow these steps,
Step 1: Launch the Update model parameters wizard (through
path Dynamics 365 > Model Management > Update model parameters....).
Step 2: On the Update Model parameters page, select the required
model in our example I have chosen the name to be Payroll Model. Click on
Next.
Step 3: On the Select referenced packages page, select package in
our case Ledger. Click on Next.
Step 4: On the Summary page, provides a brief glimpse of model
details like model description, referenced packages, and so on.
Deleting a model in D365
If you no more need a model in d365, you can delete the model. This is an easy process in d365. Before deleting a model, you must stop following services
Stop AOS web service and Stop the Batch Management Service.
you can delete your model easily by deleting the model folder in
this path below path "C:\AOSService\PackagesLocalDirectory”. after deleting
the model, you need to refresh the models to reflect the changes in your d365
project, for this you go to,
Dynamics 365 menu, point to Model management
and select Refresh models,
then finally you must synchronize the database.
In the next following articles, I will explain the above 3
activities create, update & delete operations associated with a model
individually with examples. If this article helps you, please try to share your comment.
Happy coding with D365Snippets.
Great post! Thanks for sharing
ReplyDelete