duanfu9523 2013-04-02 17:41
浏览 44
已采纳

CRM动态2011 XML缺失请求

I am facing a problem with my XML request, which is part of the web to CRM dynamics 2011 in order to create leads.

The code that i'm stuck in at the moment is as follows:

            <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>name</c:key>
                            <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Name Test 1</c:value>
                            <c:key>E-mail</c:key>
                            <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">test@test.com</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>account</b:LogicalName>
                    <b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
                </entity>
                </Create>
            </s:Body>

The name is already available from within the code that I found, I tried to add the Email attribute (even Address) but nothing in the CRM other than the name, what exactly is the error in the code? how should it be fixed?

Any help is appreciated and thank you everyone in advance.

  • 写回答

1条回答 默认 最新

  • doujing6436 2013-04-03 01:57
    关注

    I believe you need to use the logical names of the attributes instead of the display name (emailaddress1 instead of E-mail). Also I believe you need to have a KeyValuePair node for each attribute you want to send since it is an array of attributes you are sending. Try this out instead:

    <b:KeyValuePairOfstringanyType>
        <c:key>name</c:key>
        <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Name Test 1</c:value>
    </b:KeyValuePairOfstringanyType>
    <b:KeyValuePairOfstringanyType>
        <c:key>emailaddress1</c:key>
        <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">test@test.com</c:value>
    </b:KeyValuePairOfstringanyType>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题