Giter Site home page Giter Site logo

crm-sdk's Introduction

CRM-SDK

npm npm npm

Javascript Software Development Kit for Dynamics CRM Web API.

Why another library

There are several SDK's available, so why another one?

  • This library does paging for you (using @odata-nextLink to do multiple requests)
  • This library always finds correct entitySetName (which is not always: LogicalName + 's')
  • This library is promise based
  • This library supports modules
  • This library supports default WebAPI like other libraries, but also
  • This library supports extra Entity abstraction
  • This library supports annotations
  • This library supports getting OptionSet
  • This library supports Webresource uploading/publishing

Table of contents

Install

Install with Npm

$ npm install crm-sdk

Modules

//app.js
import {WebAPI} from "crm-sdk";

WebAPI.retrieveEntity("account", "475b158c-541c-e511-80d3-3863bb347ba8").then(function (data) {
    //todo logic here
});

Require

//app.js
var CRMSDK = require("crm-sdk"); //umd
var WebAPI = CRMSDK.WebAPI;

WebAPI.retrieveEntity("account", "475b158c-541c-e511-80d3-3863bb347ba8").then(function (data) {
    //todo logic here
});

Install via download

Download latest release and put reference to dist/CRMSDK.js in your index.html.

In example below, the app.js is your own application code. If you only need CRMSDK.WebAPI, you can include WebAPI.js in index.html instead of CRMSDK.js.

<html>
<body>
    <script type="text/javascript" src="CRMSDK.js"/>
    <script type="text/javascript" src="app.js"/>
</body>
</html>

In app.js, The WebAPI will be available on window.CRMSDK scope. Example for using WebAPI below:

//app.js
var WebAPI = window.CRMSDK.WebAPI;

WebAPI.retrieveEntity("account", "475b158c-541c-e511-80d3-3863bb347ba8").then(function (data) {
    //todo logic here 
});

WebAPI example

Index.html

<html>
<body>
    <script type="text/javascript" src="WebAPI.js"/>
    <script type="text/javascript" src="app.js"/>
</body>
</html>

app.js

    WebAPI.retrieveEntity("account", "475b158c-541c-e511-80d3-3863bb347ba8")
    .then(function (accountData) {
        WebAPI.updateEntity("account", accountData.accountid, {
            emailaddress1: "[email protected]"
        }).then(function (data) {
            console.log("saved " + data.accountid);
        });
    });

Entity abstraction example

Index.html

<html>
<body>
    <script type="text/javascript" src="CRMSDK.js"/>
    <script type="text/javascript" src="app.js"/>
</body>
</html>

app.js

    var WebAPI = CRMSDK.WebAPI;
    var Entity = CRMSDK.Entity;

    Entity.get("account", "475b158c-541c-e511-80d3-3863bb347ba8")
    .then(function (account) {
        account.emailaddress1 = "[email protected]";
        account.save().then(function () {
            console.log("saved! " + account.accountid);
        });
    });

Copyright and license

Code and documentation copyright 2011-2017 Dynamics Software. Code released under the MIT License.

crm-sdk's People

Contributors

nsteenbeek avatar arthud avatar aritmeester avatar

Watchers

James Cloos avatar Greg London avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.