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:
var customactivity = {
Subject: subject,
RegardingObjectId: {
Id: entityId,
LogicalName: entityLogicalName
}
};
Also, I'm not sure off hand but the property names may be case sensitive.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.