Updating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9
Summary : Updating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9
Now let’s
update a record
Syntax: Xrm.WebApi.updateRecord(entityLogicalName,
id, data).then(successCallback, errorCallback);
***Code
starts here***
var entityData =
{
"subject": “leadFromWebApi_Updated”,
"lastname": “RamLaxman”
}
Xrm.WebApi.createRecord("lead", id, entityData).then(
function success(result)
{
alert("Record
updated successfully ");
},
function (error)
{
console.log(error.message);
});
***Code
ends here***
Creating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9
Create Record:
<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
var entityData =
Let’s
see how we can create a “Lead” record using newly introduced
Web API calls in Dynamics 365 V9
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>
{
"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);
});
Subscribe to:
Posts (Atom)
Popular Posts
Contact US
EMail: info@crmonce.com
|
Phone Number: +91 9493916112,+91 8096556344 |
Whatsapp: +91 9493916112 |
Skype for Business: umamahesh@crmonce.com |
Upcoming Sessions
Dynamics365 CRM |
D365 CRM Portals/Adxstudio |
CRM Advanced Programming with Azure Integrations |
RESCO MOBILE Development |