Creating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9

Create Record:

Let’s see how we can create a “Lead” record using newly introduced
 Web API calls in Dynamics 365 V9
Xrm.WebApi.createRecord(“entityLogicalName”,data).then(successCallback,errorCallback);
// This line of code is required if you are creating from HTML webresource.

<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>

var entityData =


                {
                    "subject": “leadFromWebApi”,
                    "lastname": “Ram”
                }


Xrm.WebApi.createRecord("lead", entityData).then(
                    function success(result)
                    {
                        alert("Record Created successfully and Id is: " + result.id);
                        console.log("Account created with ID: " + result.id);
                    },
                    function (error)
                    {
                        console.log(error.message);       
                    });



1 comment:

  1. This site has lots of advantage awesome i really enjoyed reading thanks for sharing for grate info .we are also providing Save Time & Money with the all new local calfre search engine! this search engine can track all educational training institutes websites data,can find mobile numbers,everything just type one realated to ur course keyword ....java training

    ReplyDelete

Popular Posts