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

more-xrm

v0.1.2

Published

Create more applications using the Microsoft Dynamics Xrm platform, enables querying the dynamics data model from any application.

Downloads

6

Readme

more-xrm

npm

Create more applications using the Microsoft Dynamics 365/XRM platform

more-xrm is a TypeScript library that enables you to connect, query and manage Dynamics 365 data using the modern fetch api. Query operations and batch procedures are available for connecting to the Dynamics Web API.

more-xrm enables querying the dynamics data model from any application

  • provides methods for querying and managing Dynamics 365 data
  • introduces Query interface for describing columns, filters and other query information
  • provides an easy way to retrieve data for a Query, with formatting and attribute alias names
  • introduces Batch interface for describing changesets and committing them in batch
    • automatically sets related identifiers for parental records created within the same batch
  • provides methods for querying and managing Dynamics 365 Entity Metadata
  • retrieve information about Entities, Attributes and OptionSets in a concise format
  • request metadata for multiple entities and their attributes using a batch operation

Installation

This module is designed for use with Microsoft Dynamics 365 Customer Engagement Web API - either a Web Resource with a relative api path or an authToken with an associated system user record can be used.

From unpkg (cdn):

<script src="https://unpkg.com/more-xrm"></script>

or

From npm:

npm install more-xrm

How to use

  1. Import/Add the dynamics method from 'more-xrm/dist/Dynamics'

    import dynamics from 'more-xrm/dist/Dynamics';

  2. Import/Add query method and QueryOperator enum from 'more-xrm/dist/Query'

    import query, { QueryOperator } from 'more-xrm/dist/Query';

  3. Create a query for the Dynamics Account entity:

const accounts = query('account')
					.path('accounts') // Indicates Entity Name on Web API Url
					.where('name', QueryOperator.Contains, 'xrm')
					.orderBy('name')
					.select('name');
  1. Call dynamics to obtain a connection to Dynamics:

    const dynamicsClient = dynamics(); //option to pass access token

  2. Execute accounts query using dynamicsClient:

dynamicsClient.fetch(accounts).then(results => { /* results is an array of accounts */ });
  1. Update data in Dynamics by calling save:
const accountId = accounts[0].accountid; //account with name like '%xrm%'
dynamicsClient.save('accounts', { name: 'more-xrm' }, accountId).then(id => { /* id of account */ });

Example

An application will query the Account entity in Dynamics where the name contains 'xrm', then update the Account name to 'more-xrm'

import dynamics from 'more-xrm/dist/Dynamics';
import query, { QueryOperator } from 'more-xrm/dist/Query';

//Create a query
const accounts = query('account')
                    .path('accounts') // Indicates Entity Name on Web API Url
                    .where('name', QueryOperator.Contains, 'xrm')
                    .orderBy('name')
                    .select('name');

//Connect to Dynamics
const dynamicsClient = dynamics();

//Execute accounts query
dynamicsClient.fetch(accounts).then(results => { 

    if(results.length > 0) {
        const accountId = accounts[0].accountid;

        //Update data in Dynamics by calling save:
        dynamicsClient.save('accounts', { name: 'more-xrm' }, accountId).then(id => {
            
            /* Account was updated */

        });
    }
});

License

MIT License

more-xrm is licensed under the MIT license