【发布时间】:2014-11-26 08:43:49
【问题描述】:
当我尝试使用 Javascript 在 Crm 中创建 PhoneCall 记录时,我收到以下错误消息,我无法找出原因,有什么帮助吗?
{
"readyState": 4,
"responseText": "{\r\n\"error\": {\r\n\"code\": \"\", \"message\": {\r\n\"lang\": \"en-US\", \"value\": \"Error processing request stream. The property name 'from' specified for type 'Microsoft.Crm.Sdk.Data.Services.PhoneCall' is not valid.\"\r\n}\r\n}\r\n}",
"status": 400,
"statusText": "Bad Request"
}
"error"
"Bad Request"
<code>
var fromArray = [];
var FromActivityParty = {
PartyId:
{
Id: Xrm.Page.context.getUserId(),
LogicalName: "systemuser"
},
ActivityId: {
Id: TeamId,
LogicalName: "team"
},
ParticipationTypeMask: { Value: 1 }
};
fromArray[0] = FromActivityParty;
var toArray = [];
var ToActivityParty = {
PartyId:
{
Id: Xrm.Page.data.entity.getId(),
LogicalName: "account"
},
ActivityId: {
Id: TeamId,
LogicalName: "team"
},
ParticipationTypeMask: { Value: 2 }
};
toArray[0] = ToActivityParty;
var PhoneCall = {
from: fromArray,
to: toArray,
Subject: "Create a phonecall record",
OwnerId: fromArray,
PhoneNumber: phoneNumber
}
CrmRestKit.Create("PhoneCall", PhoneCall)
.fail(function (xhr, status, errorThrown)
{
console.log(JSON.stringify(xhr, null, 4));
console.log(JSON.stringify(status, null, 4));
console.log(JSON.stringify(errorThrown, null, 4));
})
.done(function (data, status, xhr) {
console.log(JSON.stringify(data, null, 4));
}
</code>
【问题讨论】:
标签: javascript crm phone-call