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

albxrmtypesgen

v1.0.9-beta3

Published

A TypeScript Declaration Generator for Dynamics 365 Forms

Downloads

17

Readme

GitHub Workflow Status GitHub Workflow Status npm Coveralls GitHub issues GitHub forks GitHub stars GitHub license GitHub top language Snyk Vulnerabilities for GitHub Repo

XrmTypesGen

A Typescript Type Declaration Generator for Dynamics 365. Inspired by the @types/xrm and XrmDefinitelyTyped.

Usage

Generate your types

Install the npm package:

npm install xrmtypesgen -g

If you wish to install the package locally use the following:

npm install xrmtypesgen --save-dev

and run via npx:

npx xrmtypesgen [options]

Generate the Xrm types:

Username & Password Authentication

xrmtypesgen --url https://myorg.crm11.dynamics.com/ --username [email protected] --password password123 --tenent https://login.windows.net/org.onmicrosoft.com --solution solutionname --output ./types

Client Credential Authentication

xrmtypesgen --url https://myorg.crm11.dynamics.com/ --tenent https://login.windows.net/myorg.onmicrosoft.com --entities "account,contact,lead" --output types --clientid myclientid --secret mysecret

Arguments:

Usage: xrmtypesgen [options]

Options:
  -V, --version              output the version number
  -u, --url <url>            D365/Dataverse Url. e.g. https://myorg.crm11.dynamics.com/
  -n, --username <username>  Username for D365/Dataverse
  -p, --password <password>  Password for D365/Dataverse
  --secret <secret>          OAuth Client Secret
  -t, --tenent <tenent>      Azure Active Directory authority. e.g. https://login.windows.net/myorg.onmicrosoft.com
  -c, --clientid <clientid>  OAuth Client Id (default: "51f81489-12ee-4a9e-aaae-a2591f45987d")
  -s, --solution <solution>  Unique D365/Dataverse Solution Name
  -e, --entities <entities>  Comma seperated list of entities
  -o, --output <output>      Output path (default: "types")
  -h, --help                 display help for command

e.g. xrmtypesgen --url https://myorg.crm11.dynamics.com/ --username [email protected] --password password123 --tenent https://login.windows.net/myorg.onmicrosoft.com --solution solutionname --output ./types

e.g. xrmtypesgen --url https://myorg.crm11.dynamics.com/ --username [email protected] --password password123 --tenent https://login.windows.net/myorg.onmicrosoft.com --entities account,contact,lead --output ./types

e.g. xrmtypesgen --url https://myorg.crm11.dynamics.com/ --tenent https://login.windows.net/myorg.onmicrosoft.com --entities "account,contact,lead" --output types --clientid myclientid --secret mysecret

Using your types

The generated type declaration depend on @types/xrm, so lets install them

npm install @types/xrm --save-dev

You are now free to use the new type declaration... Here are some examples.

Form Context:

function myfunc(context: Xrm.Events.EventContext) {
  const formContext = context.getFormContext() as Xrm.Ext.Forms.contact.main.Contact.Form;
  ...
}

Get an attribute, and set the value:

formContext.getAttribute('birthdate').setValue(new Date(1990, 6, 20));

Disable the 'birth date' control within the section called 'PERSONAL INFORMATION', that is within the tab called 'DETAILS_TAB':

formContext.ui.tabs
  .get('DETAILS_TAB')
  .sections.get('PERSONAL INFORMATION')
  .controls.get('birthdate')
  .setDisabled(true);

Here's a little video demo...

demo video

Why?

Well, I've been using @types/xrm for over 5 years now and XrmDefinitelyTyped for about 2 years. I love the added features XrmDefinitelyTyped provides but dislike the fact that it doesn't extend on @types/xrm given most D365/XRM projects use these types. So I set about creating my own tool to generate type declarations that extend @type/xrm 😁