more-xrm
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):
or
From npm:
npm install more-xrm
How to use
-
Import/Add the
dynamics
method from'more-xrm/dist/Dynamics'
import dynamics from 'more-xrm/dist/Dynamics';
-
Import/Add
query
method andQueryOperator
enum from'more-xrm/dist/Query'
import query, { QueryOperator } from 'more-xrm/dist/Query';
-
Create a
query
for the Dynamics Account entity:
.path'accounts' // Indicates Entity Name on Web API Url .where'name', QueryOperator.Contains, 'xrm' .orderBy'name' .select'name';
-
Call
dynamics
to obtain a connection to Dynamics:const dynamicsClient = dynamics(); //option to pass access token
-
Execute
accounts
query usingdynamicsClient
:
dynamicsClient.fetchaccounts.then;
- Update data in Dynamics by calling
save
:
; //account with name like '%xrm%'dynamicsClient.save'accounts', , accountId.then;
Example
An application will query the Account entity in Dynamics where the name contains 'xrm', then update the Account name to 'more-xrm'
;; //Create a query .path'accounts' // Indicates Entity Name on Web API Url .where'name', QueryOperator.Contains, 'xrm' .orderBy'name' .select'name'; //Connect to Dynamics; //Execute accounts querydynamicsClient.fetchaccounts.then;
License
more-xrm is licensed under the MIT license