首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >动态CRM制造事件

动态CRM制造事件
EN

Stack Overflow用户
提问于 2016-04-15 08:03:37
回答 1查看 515关注 0票数 0

我试图通过他们的API在Dynamics上创建一个事件。

然而,当我试图创建事件时,我成功地使用了:

代码语言:javascript
复制
    $accountsRequest = EntityUtils::getCreateCRMSoapHeader($CRMURL, $securityData).
'
      <s:Body>
            <Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
            <entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
                    <b:KeyValuePairOfstringanyType>                         
                        <c:key>title</c:key>
                        <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Its a sunday web case - second</c:value>
                    </b:KeyValuePairOfstringanyType>                     
                </b:Attributes>
                <b:EntityState i:nil="true"/>
                <b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
                <b:Id>'.$accountId.'</b:Id>
                <b:LogicalName>incident</b:LogicalName>
                <b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
            </entity>
            </Create>
        </s:Body>
    </s:Envelope>
    ';

$accountId looks like this:
dabc10e9-df02-e611-80d9-5065f38a9b01

我得到了以下错误:

您应该指定父联系人或帐户。-2147204080您应该指定父联系人或account.2016-04-15T07:59:11.6607106Z-2147204080,您应该指定父联系人或帐户。

知道我错过了什么吗?

编辑更新并尝试如下:

代码语言:javascript
复制
'
      <s:Body>
            <Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
            <entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
                    <b:KeyValuePairOfstringanyType>                         
                        <c:key>title</c:key>
                        <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Its a sunday web case - second</c:value>
                    </b:KeyValuePairOfstringanyType>
                    <b:KeyValuePairOfstringanyType>
                        <c:key>customerid</c:key>
                        <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">19622e39-e502-e611-80da-5065f38ada41</c:value>
                    </b:KeyValuePairOfstringanyType>                                                              
                </b:Attributes>
                <b:EntityState i:nil="true"/>
                <b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
                <b:Id>00000000-0000-0000-0000-000000000000</b:Id>
                <b:LogicalName>incident</b:LogicalName>
                <b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>                    
            </entity>
            </Create>
        </s:Body>
    </s:Envelope>
    ';

但还是一样的错误

编辑#2,也尝试过:

代码语言:javascript
复制
'
      <s:Body>
            <Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
            <entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
                    <b:KeyValuePairOfstringanyType>                         
                        <c:key>title</c:key>
                        <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Its a sunday web case - second</c:value>
                    </b:KeyValuePairOfstringanyType>
                    <b:KeyValuePairOfstringanyType>
                        <c:key>customerid</c:key>
                        <b:value i:type="a:EntityReference">
                           <a:Id>19622e39-e502-e611-80da-5065f38ada41</a:Id>
                           <a:LogicalName>account</a:LogicalName>
                           <a:Name i:nil="true" />
                        </b:value>
                    </b:KeyValuePairOfstringanyType>                                                              
                </b:Attributes>
                <b:EntityState i:nil="true"/>
                <b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
                <b:Id>00000000-0000-0000-0000-000000000000</b:Id>
                <b:LogicalName>incident</b:LogicalName>
                <b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>                    
            </entity>
            </Create>
        </s:Body>
    </s:Envelope>
    ';

我正在犯错误:

DeserializationFailedThe格式化程序在反序列化消息时抛出一个异常:试图反序列化参数http://schemas.microsoft.com/xrm/2011/Contracts/Services:entity时出错。InnerException消息是‘错误在第68行第57位。'EndElement’'KeyValuePairOfstringanyType‘来自命名空间'http://schemas.microsoft.com/xrm/2011/Contracts’并不是预期的。期望元素“值”。有关更多细节,请参见InnerException。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-15 08:39:33

看起来,您可能试图将一个帐户id值放入Id属性中。Id属性是指事件的Id .最好让CRM为您生成Id,所以不要为id属性提供任何内容(除非您有意设置新事件的id)。

此错误指的是EntityReference类型的customerid属性。EntityReferences具有Id和LogicalName属性。将您的$accountId值放入customerid.Id,并使customerid.LogicalName成为"account“。EntityReferences也有Name属性,但您不必提供该属性。

您的编辑#2看起来可能有一些名称空间问题。试试这个:

代码语言:javascript
复制
<b:KeyValuePairOfstringanyType>
    <c:key>customerid</c:key>
    <c:value i:type="b:EntityReference">
       <b:Id>19622e39-e502-e611-80da-5065f38ada41</b:Id>
       <b:LogicalName>account</b:LogicalName>
       <b:Name i:nil="true" />
    </c:value>
</b:KeyValuePairOfstringanyType>      
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36641533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档