为CRM Dynamics 2011中的查找字段增加价值 [英] Add value to lookup field in CRM dynamics 2011

查看:46
本文介绍了为CRM Dynamics 2011中的查找字段增加价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功地使用PHP与CRM Dynamics 2011建立了成功的在线连接。
我什至设法创建了一个新的销售线索并添加了以下显示的值:

 < s:Body> 
< Create xmlns = http://schemas.microsoft.com/xrm/2011/Contracts/Services>
<实体xmlns:b = http://schemas.microsoft.com/xrm/2011/Contracts xmlns:i = http://www.w3.org/2001/XMLSchema-instance> ;
< b:属性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>此处测试< / c:value>
< / b:KeyValuePairOfstringanyType>
< b:KeyValuePairOfstringanyType>
< c:key>电子邮件地址1< / c:key>
< c:value i:type = d:string xmlns:d = http://www.w3.org/2001/XMLSchema> test@test.com< / c:value>
< / b:KeyValuePairOfstringanyType>
< b:KeyValuePairOfstringanyType>
< c:key> address1_city< / c:key>
< c:value i:type = d:string xmlns:d = http://www.w3.org/2001/XMLSchema>位置此处< / c:value>
< / b:KeyValuePairOfstringanyType>
< b:KeyValuePairOfstringanyType>
< c:key>电话1< / c:key>
< c:value i:type = d:string xmlns:d = http://www.w3.org/2001/XMLSchema> 123456< / c:value>
< / b:KeyValuePairOfstringanyType>
< / b:属性>
< b:EntityState i:nil = true />
< b:FormattedValues xmlns:c = http://schemas.datacontract.org/2004/07/System.Collections.Generic />
< b:Id> 00000000-0000-0000-0000-000000-000000000000< / b:Id>
< b:LogicalName>帐户< / b:LogicalName>
< b:RelatedEntities xmlns:c = http://schemas.datacontract.org/2004/07/System.Collections.Generic />
< / entity>
< / Create>
< / s:Body>

我现在遇到的问题是如何向查找字段 primarycontactid添加值/ p>

例如,我想添加 Mahmoud Jabado的值



我有红色表示一个javascript函数,我对在哪里以及如何实现它有些迷惑。
不能像上面的XML一样设置值吗?



PS:我使用PHP编程,编程水平为没那么高。
提前谢谢大家。

解决方案

有一种方法可以直接在xml中进行设置,但是您需要您要添加的联系人的向导。类似于以下内容的代码在我以前使用的旧Java应用程序中对我有用,因此也应该对您有用:

  < b:KeyValuePairOfstringanyType> 
< c:key> primarycontactid< / c:key>
< c:value i:type = b:EntityReference>
< b:Id> [此处有联系向导]< / b:Id>
< b:LogicalName> contact< / b:LogicalName>
< b:名称i:nil = true />
< / c:值>
< / b:KeyValuePairOfstringanyType>

对于< b:Name> 可以在其中放置联系人姓名,但是如果您要创建/更新记录,则不需要。



(注意:我猜到了名称空间,因此可能需要一些调整)


I managed to make a successful online connection using PHP to the CRM dynamics 2011. I even managed to create a new lead and add the following presented values:

<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">Test Here</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>
                        <b:KeyValuePairOfstringanyType>
                            <c:key>address1_city</c:key>
                            <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Location Here</c:value>
                        </b:KeyValuePairOfstringanyType>
                        <b:KeyValuePairOfstringanyType>
                            <c:key>telephone1</c:key>
                            <c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">123456</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 thing i'm stuck at now is how to add a value to lookup field "primarycontactid"

let's say for example I want to add the value of "Mahmoud Jabado"

I have red that there is a javascript function, I was just a little lost on where and how to implement it. isn't there a way to set the value in a similar way like the above XML ?

P.S: I am programing in PHP and my programing level is not high that much. Thanks everyone in advance.

解决方案

There is a way to set this directly in the xml, but you need the Guid of the contact you're trying to add. Something similar to the following worked for me in an old java application I worked on some time ago so should work for you too:

<b:KeyValuePairOfstringanyType>
    <c:key>primarycontactid</c:key>
    <c:value i:type="b:EntityReference">
        <b:Id>[CONTACT GUID GOES HERE]</b:Id>
        <b:LogicalName>contact</b:LogicalName>
        <b:Name i:nil="true" />
    </c:value>
</b:KeyValuePairOfstringanyType>

For <b:Name> you could put the contact name in there, but it shouldn't be required if you're creating/updating a record.

(Note: I have guessed the namespaces so it may need a bit of tweaking)

这篇关于为CRM Dynamics 2011中的查找字段增加价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆