[英]PHP Unable to set empty value to lookup field on Dynamics CRM 2013
[英]Add value to lookup field in CRM dynamics 2011
我設法使用PHP與CRM Dynamics 2011建立了成功的在線連接。我什至設法創建了新的線索並添加了以下呈現的值:
<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>
我現在遇到的問題是如何向查找字段“ primarycontactid”添加值
舉例來說,我要添加“ Mahmoud Jabado”的值
我有一個JavaScript功能,我對在哪里以及如何實現它有些迷惑。 是否沒有辦法像上述XML一樣設置值?
PS:我正在用PHP編程,但是我的編程水平不是很高。 提前謝謝大家。
有一種方法可以直接在xml中進行設置,但是您需要嘗試添加的聯系人的Guid。 在我以前使用的舊Java應用程序中,與以下類似的內容對我有用,因此也應該對您有用:
<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>
對於<b:Name>
您可以在其中放置聯系人姓名,但是如果要創建/更新記錄,則不需要。
(注意:我猜到了名稱空間,因此可能需要一些調整)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.