[英]How do you create a custom activity in CRM 2011 using JavaScript?
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.
为类型“ Microsoft.Crm.Sdk.Data.Services.new_customactivity”指定的属性名称“主题”无效。
The first property I add to the customactivity
object is referenced in the error message. 错误消息中引用了我添加到
customactivity
对象的第一个属性。 I get the same message when I add regardingobjectid
first. 当我首先添加
regardingobjectid
objectid时,我得到相同的消息。
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. 另外,我不确定立即可用,但属性名称可能区分大小写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.