简体   繁体   English

如何使用JavaScript在CRM 2011中创建自定义活动?

[英]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.

相关问题 您如何在Dynamics CRM 2011中拥有多个JavaScript库 - How do you have multiple javascript libraries in Dynamics CRM 2011 如何使用 CRM 2011 Web 服务和 JavaScript 在 CRM 2011 中执行 FetchXML? - How to Execute FetchXML in CRM 2011 using a CRM 2011 webservice and JavaScript? 如何使用JavaScript在CRM 2011中读取以下属性? - How do I read an attribute below in CRM 2011 using javascript? 使用CRM2011-2013中的REST端点创建电子邮件活动 - Create an email activity using REST Endpoints in CRM2011-2013 如何使用Javascript获取服务器版本CRM 2011或CRM 2013 - How to get Server Version CRM 2011 or CRM 2013 using Javascript 在Dynamic crm 2011中,在已完成的活动上右键单击只读文本时会收到错误消息吗? - Do you get an error when right clicking read only text on a completed activity in dynamic crm 2011? 在CRM 2011中,如何使用javascript检索按名称显示的对话框guid? - In CRM 2011, how to retrieve a Dialog guid by name using javascript? 如何在CRM 2011中使用Javascript和oData获取PartyList字段的值 - How to get value of PartyList field using Javascript and oData in CRM 2011 如何使用Javascript将数据插入CRM 2011实体? - How to insert data to a CRM 2011 entity using Javascript? 在CRM 2011中使用Java脚本创建记录 - Create Record using java script in crm 2011
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM