npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hso/d365-cli

v7.0.8

Published

Dynamics 365 Command Line Interface for TypeScript projects for Dataverse

Downloads

465

Readme

D365-CLI Forms/Webresources project automation

npm npm npm npm

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-cli

For 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-project

This 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 done

Now go to the Webresources folder, which is the root folder of the project:

  cd my-first-project
  cd Webresources

Add Entity

To add an entity to the project use following commands:

  hso-d365 generate Entity MyEntity

This will ask for the Logical Name of the Entity:

  Adding D365 Entity MyEntity...
  What is the Entity Logical Name? myentity
  Adding D365 Entity done

Add Webresource

To add an Webresource to the project use following commands:

  hso-d365 generate Webresource MyWebresource

Deploy

To build changes made to Entities and Webresources to be deployed use following command:

  npm run build:prod

Now 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 deploy

Code 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');