I’ve tried this:
function CreateCustomActivity(oDataPath, oDataSetName, subject, entityId, entityTypeCode) {
var customactivity = new Object();
customactivity.subject = subject;
customactivity.regardingobjectid = entityId;
customactivity.activitytypecode = entityTypeCode;
var jsonCustomActivity = JSON.stringify(customactivity);
var req = new XMLHttpRequest();
req.open("POST", oDataPath + "/" + oDataSetName, false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.send(jsonCustomActivity);
}
however, I get the following error:
Error processing request stream. The
property name ‘subject’ specified for
type
‘Microsoft.Crm.Sdk.Data.Services.new_customactivity’
is not valid.
The first property I add to the customactivity object is referenced in the error message. I get the same message when I add regardingobjectid first.
Try creating your activity object with the following notation:
Also, I’m not sure off hand but the property names may be case sensitive.