function abc (executionContext){
getting html input file by var html = document.getElementId(/file/);
var case id = window.parent.Xrm.page.data.entity.getId();
var entityname = window.parent.Xrm.page.data.entity.getEntityName();
if (entityname == /incident/ && case id != null){
const html = window.btoa(html);
var data = {
/notetext/ : /upload/,
/subject/ : /Upload file/,
/mimetype/ : /application/xlsx/,
/filenameattachment/ : /upload file.xlsx/,
/isdocument/ : true,
/documentbody/ : html,
/objectid_incident@data.bind/ : {
/logicalname/ : /incidents/
/id/ : case id
}
};
Xrm.WebApi.createRecord(/annoatation/, data).then(
function success (result) {
alert(result.id);
},
function(error) {
console.log(error.message);
}
);
}
}