@hso/d365-cli v7.0.9
D365-CLI Forms/Webresources project automation
Introduction
A Command-line interface for D365 Project Development based on HSO best practices.
It will set up a namespaced project for Forms and Webresources development including some utils for Annotation, WebApi, Base64, etcetera. The project uses TypeScript and Xrm DefinitelyTyped intellisense. For entities, it can generate entity forms including methods for getting tabs, controls, attributes. For entities, it can generate models. The entity model can be used for intellisense and helps with odata. The project has a Translation util class and the translation command generates Resx file. The deployment will set/remove dependencies to webresource files. Building obfuscated code and deploying to the D365 Solution can be done in a few CLI Commands.
Invoke the tool on the command line through the hso-d365 executable. Online help is available on the command line. See wiki for detailed CLI Commands.
Since the features and thus the documentation is growing fast, this readme only contains a Getting Started and a few examples. All documentation and examples can be found in the wiki.
Getting Started
Install CLI
  npm install -g @hso/d365-cliFor a more detailed installation and prerequisites see wiki for Installation.
Create project
To create a new project, go to the parent directory of your new workspace and use the following commands:
  hso-d365 new my-first-projectThis will ask a couple of questions to set up the project:
  Initializing D365 Project my-first-project
  D365 environment url (eg. https://yourproject.crm4.dynamics.com):? https://yourproject.crm4.dynamics.com
  D365 Solution name:? CoreEssentials
  D365 Publisher Prefix (3 chars a-z):? hso
  Namespace (eg. Customer or Product name):? mfp
  Installing npm packages. This may take a while...
  Initializing D365 Project doneNow go to the Webresources folder, which is the root folder of the project:
  cd my-first-project
  cd WebresourcesAdd Entity
To add an entity to the project use following commands:
  hso-d365 generate Entity MyEntityThis will ask for the Logical Name of the Entity:
  Adding D365 Entity MyEntity...
  What is the Entity Logical Name? myentity
  Adding D365 Entity doneAdd Webresource
To add an Webresource to the project use following commands:
  hso-d365 generate Webresource MyWebresourceDeploy
To build changes made to Entities and Webresources to be deployed use following command:
  npm run build:prodNow the folder Webresources/dist/mfp_ contains the bundled and obfuscated files to be deployed. It's recommended to deploy in the same folder structure to D365.
Use following command to deploy
  hso-d365 deployCode Examples
Xrm DefinitelyTyped and generated QuoteService
static async clone(executionContext: Xrm.Events.EventContext): Promise<void> {
    const formContext = executionContext.getFormContext(),
        id = formContext.data.entity.getId(),
        quote = await QuoteService.retrieveClone(id),
        quote.name = `Copy - ${quote.name}`,
        validation = await QuoteService.validateRecord(quote);
    if (validation.isValid) {
        try {
            await QuoteService.createRecord(quote);
        } catch (e) {
            console.log(`${e.code} - ${e.message}`);
        }
    }
}Entity (Account, Contact) Service and Model
    const accounts = await AccountService.retrieveMultipleRecords({ 
        select: ['name'],
        expands: [{
            attribute: 'primarycontactid',
            select: ['fullname']
        }]
    }); // returns AccountModel[]
    for (const account of accounts) {
        // account.primarycontactid is ContractModel
        console.log(`Contact fullname: ${account.primarycontactid.fullname}`);
    }Action via WebApi
    const result1 = await WebApi.executeAction('WhoAmI');
    const result2 = await WebApi.executeAction(
        'yourAction', {value: 'x'}, 'account', 'idOfAccount');9 months ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago