サービス アクティビティを作成しようとしていますが、エラーがスローされます。コードは次のとおりです。
var oDataPath = Xrm.Page.context.getServerUrl() + "/XRMServices/2011/OrganizationData.svc";
var oDataSetName = "ServiceAppointmentSet";
var entityTypeCode = "4212"; // Type code of ServiceAppointment
var subject = 'Test Subject';
var entityId = Xrm.Page.data.entity.getId();
var serviceId = "AFE9429-ABCE-E211-877A-000C298A36A7";
var customactivity = new Object();
customactivity.Subject = subject;
customactivity.ActivityTypeCode = entityTypeCode;
customactivity.RegardingObjectId =
{
Id: entityId,
LogicalName: "incident",
Name: subject
};
var punchInTime = GetPunchInTime();
customactivity.ScheduledStart = punchInTime;
customactivity.ScheduledEnd = punchInTime;
//---- serviceId
if (serviceId != null) {
customactivity.ServiceId =
{
Id: serviceId,
LogicalName: "service",
Name: "Support"
};
}
var jsonCustomActivity = JSON.stringify(customactivity);
var createRequest = new XMLHttpRequest();
createRequest.open("POST", oDataPath + "/" + oDataSetName, false);
createRequest.setRequestHeader("Accept", "application/json");
createRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");
createRequest.send(jsonCustomActivity);
エラーの説明:
ステータス: 400 不正なリクエスト
エラー:
Error processing request stream. Error encountered in converting the value from request payload for property 'Id' to type 'Guid',
which is the property's expected type. See inner exception for more detail.
誰かが問題を見つけるのを手伝ってくれますか?