2009-07-27 94 views
3

因此,如果在CRM中沒有爲其保留數據,則使用FetchXML似乎不會返回列。MS CRM 4.0。即使爲空,FetchXML也會返回列

例如:

<fetch mapping="logical" count="50"> 
<entity name="contact"> 
    <attribute name="contactid" /> 
    <attribute name="emailaddress1" /> 
    <attribute name="firstname" /> 
    <attribute name="jobtitle" /> 
    <attribute name="lastname" /> 
    <attribute name="mobilephone" /> 
    <attribute name="parentcustomerid" /> 
    <attribute name="telephone1" /> 
    <filter> 
     <condition attribute="parentcustomerid" operator="eq" value="94bf630f-b364-de11-8f1d-001cc02e75b4" /> 
    </filter> 
</entity> 

但是返回的XML如下:

<resultset morerecords="0" paging-cookie="&lt;cookie page=&quot;1&quot;&gt;&lt;contactid last=&quot;{86805DB5-E06B-DE11-81EE-001CC02E75B4}&quot; first=&quot;{7CBC9B9A-E06B-DE11-81EE-001CC02E75B4}&quot; /&gt;&lt;/cookie&gt;"> 
<result> 
    <contactid>{7CBC9B9A-E06B-DE11-81EE-001CC02E75B4}</contactid> 
    <emailaddress1>[email protected]</emailaddress1> 
    <firstname>tommy</firstname> 
    <jobtitle>Dude</jobtitle> 
    <lastname>Smith</lastname> 
    <parentcustomerid yomi="" name="Tom's bike shoppe" dsc="0" type="1">{94BF630F-B364-DE11-8F1D-001CC02E75B4}</parentcustomerid> 
</result> 
<result> 
    <contactid>{86805DB5-E06B-DE11-81EE-001CC02E75B4}</contactid> 
    <emailaddress1>[email protected]</emailaddress1> 
    <firstname>jason</firstname> 
    <lastname>Finch</lastname> 
    <parentcustomerid yomi="" name="Tom's bike shoppe" dsc="0" type="1">{94BF630F-B364-DE11-8F1D-001CC02E75B4}</parentcustomerid> 
</result> 

第2紀錄至今無人JOBTITLE既不的記錄有mobilephone數字例如。這使得綁定這些數據控制棘手。

所以基本上我的問題是,是否有可能強制CRM使用空值或空值返回這些字段?

回答

2

總之,沒有。

我不知道綁定情況的具體情況,但您是否可以擁有一個自定義模型類,您可以使用提取結果填充該對象,然後綁定到該對象而不是綁定到XML?

+0

我確實最終走了這條路線,並添加了所需的列,如果他們沒有在取回中返回。 – Fishcake 2009-07-29 08:49:55

1

另一種選擇是不使用API​​的FetchXML部分並使用RetrieveMultiple獲取強類型的BusinessEntity記錄。

相關問題