Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Javascript在Crm中创建电话通话记录_Javascript_Crm_Phone Call - Fatal编程技术网

使用Javascript在Crm中创建电话通话记录

使用Javascript在Crm中创建电话通话记录,javascript,crm,phone-call,Javascript,Crm,Phone Call,当我尝试使用Javascript在Crm中创建电话通话记录时,我收到以下错误消息,我无法找出原因,是否有帮助 { "readyState": 4, "responseText": "{\r\n\"error\": {\r\n\"code\": \"\", \"message\": {\r\n\"lang\": \"en-US\", \"value\": \"Error processing request stream. The property name 'from' spe

当我尝试使用Javascript在Crm中创建电话通话记录时,我收到以下错误消息,我无法找出原因,是否有帮助

 {
    "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>

对我来说,错误信息听起来很清楚。 “发件人”似乎不是电话呼叫类型的有效属性名称


快速猜测:您是否尝试过将“From”与大写一起使用?我看到你的其他属性是这样写的

如果使用REST端点,则需要使用与活动方实体的关系将添加到添加

以下是我使用的代码:

var phoneCall={};
phoneCall.phoneCall\活动\双方=[
新的ActivityParty(2,“系统用户”、“GUID”),
新活动伙伴(1,“联系人”、“GUID”)
]; //2='到'1='从'
//TODO:使用phoneCall对象创建调用。
函数ActivityParty(类型掩码、逻辑名称、partyId){
if(partyId&&partyId[0]=='{'){
partyId=partyId.子字符串(1,partyId.长度-1);
}
this.PartyId={
LogicalName:LogicalName,
Id:partyId
};
此.ParticipationTypeMask={
值:typeMask
};
}
是的,我确实尝试了“发件人”,然后我将获得“处理请求流时出错。为类型“Microsoft.Crm.Sdk.Data.Services.PhoneCall”指定的属性名“发件人”无效。”