function uploadToNoteAttachment(base64,fileName,fileType) {
var record = {};
record.filename = fileName; // Text
record.documentbody = base64; // Text
record.subject = fileName; // Text
// Set the Regarding field to a case with GUID taken from the id parameter in the URL
record["objectid_incident@odata.bind"] = "/incidents({{ request.params.id }})"; // Lookup
webapi.safeAjax({
type: "POST",
contentType: "application/json",
url: "/_api/annotations",
data: JSON.stringify(record),
success: function (data, textStatus, xhr) {
var newId = xhr.getResponseHeader("entityid");
console.log(newId);
},
error: function (xhr, textStatus, errorThrown) {
console.log(xhr);
}
});
}