JS web resource Archives -

Tag Archives: JS web resource

Passing parameters to JavaScript Web Resource function in Dynamics CRM

Introduction: In this blog we will see how we can pass parameters to a JavaScript function where the function is generic and can be reused. Implementation: Let’s take an example where you would check if account number is present or not in the account field. 1. Create a JS function to check if account number is present in the Account field. 2. Add function to the Web Resource library in solution. 3. Adding it to the form of the Account entity to reflect the output on load of the page. 4. Checking for the result on load of Account. Hope this helps …

Create, Update, Delete data Client side using XRM Web API in Dynamics 365 (Client API Reference)

Introduction Below is the Syntax that’s available to create, delete, update a record in Dynamics 365 Online V9.X using JavaScript. Create record (Client API Reference) Below is the Syntax that’s available to create a record in Dynamics 365 Online V9.X using JavaScript Syntax : Xrm.WebApi.createRecord(entityLogicalName, data).then(successCallback, errorCallback); Implementation : Let’s take an example where you would like to Create the Account record. // define the data to create new accountvar data = { “name”: “Sample Account”, “creditonhold”: false, “address1_latitude”: 47.639583, “description”: “This is the description of the sample account”, “revenue”: 5000000, “accountcategorycode”: 1 }// create account recordXrm.WebApi.createRecord(“account”, data).then( function success(result) { console.log(“Account created with ID: ” + result.id); // perform operations on record creation }, function (error) { console.log(error.message); // handle error conditions }); Update record (Client API Reference) Below is the Syntax that’s available to update a record in Dynamics 365 Online V9.X using JavaScript Syntax :  Xrm.WebApi.updateRecord(entityLogicalName, id, data).then(successCallback, errorCallback); Implementation : Let’s take an example where you would like to Update the Account record. // define the data to update accountvar data = { “name”: “Updated Sample Account “, “creditonhold”: true, “address1_latitude”: 47.639583, “description”: “This is the updated description of the sample account”, “revenue”: 6000000, “accountcategorycode”: 2}// update the recordXrm.WebApi.updateRecord(“account”, “5531d753-95af-e711-a94e-000d3a11e605”, data).then( function success(result) { console.log(“Account updated”); // perform operations on record update }, function(error) { console.log(error.message); // handle error conditions }); Delete record (Client API Reference) Below is the Syntax that’s available to delete a record in Dynamics 365 Online V9.X using JavaScript Syntax : Xrm.WebApi.deleteRecord(entityLogicalName, id).then(successCallback, errorCallback); Implementation : Let’s take an example where you would like to Delete the Account record. Xrm.WebApi.deleteRecord(“account”, “5531d753-95af-e711-a94e-000d3a11e605”).then( function success(result) { console.log(“Account deleted”); // perform operations on record deletion }, function (error) { console.log(error.message); // handle error conditions }); Hope this Helps ….

SEARCH :

FOLLOW CLOUDFRONTS BLOG :

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :