In this Blog, we will see how to Create New Records Programmatically with JavaScript in Dataverse / MSCRM
You can pass different parameter based in the "record" to create with field values
Power Platform, Microsoft Dynamics CRM 4.0, 2011, 2013, 2015, 2016, D365 CE, C#, ASP.net and MVC, Azure
var record = {};
record.bosch_dayname = "Name of the Record"; // Text
Xrm.WebApi.createRecord("bosch_day", record).then(
function success(result) {
var newId = result.id;
console.log(newId);
},
function(error) {
console.log(error.message);
} );
You can pass different parameter based in the "record" to create with field values
In this blog we will see how to How to Retrieve Records using FETCHXML using JavaScript in MSCRM or Dataverse
function retriveRecordusingFetchXML() {
var fetchXml = `
<fetch>
<entity name="account">
<attribute name="accountid" />
<attribute name="name" />
</entity>
</fetch>`;
var encodedFetchXML = encodeURIComponent(fetchXml);
var fetchXmlRequest = "?fetchXml=" + encodedFetchXML;
Xrm.WebApi.retrieveMultipleRecords("account", fetchXmlRequest).then(
function success(result) {
for (const record of result.entities) {
var name = record.name;
}
},
function (error) {
var alertMessage = { text: error.message };
Xrm.Navigation.openAlertDialog(alertMessage, null);
}
);
}
In this Blog we will see how to Use Xrm.WebApi.retrieveRecord in Dataverse / MSCRM
function retreiveRecord(executionContext) {
var formContext = executionContext.getFormContext();
var getCurrentRecordid = formContext.data.entity.getId();
getCurrentRecordid = getCurrentRecordid.replace("{", "").replace("}", "");
Xrm.WebApi.retrieveRecord("TABLENAME", getCurrentRecordid , "?$select=fieldname1,fieldname2").then(
function success(result) {
console.log(result);
// Columns
var bosch_dayid = result["fieldname1"];
var bosch_dayname = result["fieldname2"];
},
function (error) {
console.log(error.message);
}
);
}
In this Blog, we will see how to Create New Records Programmatically with JavaScript in Dataverse / MSCRM var record = {}; record.bosch_day...