Call Dynamics 365 Web API Using JavaScript - Using Xrm.WebApi
Create a record for custom entity record by calling Web API
var Gender;
var Indian;
var Technologies = "";
function CreatePerson() {
var data =
{
"new_firstname": document.getElementById("firstName").value,
"new_lastname": document.getElementById("lasttName").value,
"new_dob": document.getElementById("DOB").value,
"new_age": document.getElementById("Age").value,
"new_gender": Gender,
"new_indian": Indian,
"new_salary": parseInt(document.getElementById("Salary").value),
"new_technology": Technologies
}
debugger;
Xrm.WebApi.createRecord("new_person", data).then(
function success(result) {
alert("Peron created with id: " + result.id);
},
function (error) {
alert("Error in API: " + error.message);
}
);
}
var Gender;
var Indian;
var Technologies = "";
function CreatePerson() {
var data =
{
"new_firstname": document.getElementById("firstName").value,
"new_lastname": document.getElementById("lasttName").value,
"new_dob": document.getElementById("DOB").value,
"new_age": document.getElementById("Age").value,
"new_gender": Gender,
"new_indian": Indian,
"new_salary": parseInt(document.getElementById("Salary").value),
"new_technology": Technologies
}
debugger;
Xrm.WebApi.createRecord("new_person", data).then(
function success(result) {
alert("Peron created with id: " + result.id);
},
function (error) {
alert("Error in API: " + error.message);
}
);
}
Comments
Post a Comment