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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功