我试过这个:
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);
}
但是,我收到以下错误:
处理请求流时出错。为类型“Microsoft.Crm.Sdk.Data.Services.new_customactivity”指定的属性名称“主题”无效。
我添加到customactivity
对象的第一个属性在错误消息中被引用。我regardingobjectid
第一次添加时收到相同的消息。