I've been looking to add a feature where using client side script, we would like to create a note (annotation). I've been able to create a note but haven't been able to assign it to a custom entity. Here is the client side code we're using:
var clientID = formContext.getAttribute("client").getValue()[0].id;
// define the data to create new annotation
var data =
{
"subject": "Client Interaction",
"notetext": "Client Interaction logged",
"isdocument": false,
"objectid":
{
"logicalname": "custom_client",
"custom_clientid": clientID
}
}
// create annotation (note) record
Xrm.WebApi.createRecord("annotation", data).then(
function success(result) {
console.log("Note created with ID: " result.id);
// perform operations on record creation
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
I'm successfully able to create the annotation (note) if I remove the objectid property but we really want to create the note so it's regarding (linked) to the custom entity client. The error we see in the console is:
An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.
Any help would be greatly appreciated!