Hi Guys,
I created one custom entity in that custom entity i have a ribbon while click the button javascript is called,In the javascript i add the custom action for send the email..i don't know where i made mistake..help me guys..this is my code
function sendAction() {
var Id = Xrm.Page.data.entity.getId().replace('{', '').replace('}', '');
var serverURL = Xrm.Page.context.getClientUrl();
// pass the id as input parameter
var data = {
"Description" : "CRM Meeting",
"Subject" : "Invoking from Web API"
};
var query = "new_receptionmanagementsystems(" +Id+ ")/Microsoft.Dynamics.CRM.new_ActionforReceptionManagementSystem";
var req = new XMLHttpRequest();
// specify name of the entity, record id and name of the action in the Wen API Url
req.open("POST", serverURL + "/api/data/v8.0/" + query, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
req.onreadystatechange = null;
if (this.status == 200) {
var data = JSON.parse(this.response);
alert(data);
} else {
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
// send the request with the data for the input parameter
req.send(window.JSON.stringify(data));
}
Thank You
*This post is locked for comments