Code generators
focus on tasks that matters
Overview
Dynamics Mobile CLI provides code generation tool, allowing the developer to quickly generate source code for specific purposes based on predefined templates.
It allows the developer to automate frequent and boring task like creating a new business object definition to communicate with remote system or create a new view, task and others.
How it works
Using the code generators is easy as running a command from the terminal within the root directory of your project.
Let's assume we have the following folder structure
So, we have our app called myApp2 and we want to generate a new "empty" business object for our app. We need to open terminal (command prompt) and execute the following commands
The result of the command is a new file Customer.bo.json in our Business Object folder
We may now open the newly created file and see the content:
So, we have a newly generated skeleton for our business object , which we can augment by adding more properties
Templates
Dynamics Mobile SDK comes with a set of built-in code generators or so called "templates". Following list of built-in templates with instructions how to use them
template: Entity
The Entity template generates a business object definition skeleton. The "skeleton" definition contains basic business object attributes like name and properties and the default primary key property DMS_ROWID.
The upper command will generate a skeleton business object definition in ./src/Business Object folder.
template: Service Entity
The Service Entity template generates a complete business object definition from a remote service like Microsoft Dynamics 365 Business Central , Microsoft Dynamics 365 for Operations others. It is required that the application area where we develop our application to have a defined livelinkservice and we need to know its name.
Once we have these , we can execute the following command from the app's directory:
And we now have a new Company business object file created in ./src/Business Objects directory. We can use this object now to directly query Company records from the remote service by using LiveLinkQuery and create, update and delete records.
Parameters
Parameter | Value | Notes |
template | service-entity | |
name | string value (letters and digits only, no spaces and special characters) | The name of the entity to look for in the remote service |
service | string value (letters and digits only, no spaces and special characters) | The name of the service as it is defined in the user's role settings in the apparea |
overwrite | true | false | Overwrites the existing local business object file, if it exists |
See also
Last updated