我有这个 FetchXML 查询,它根据所有者用户所在的业务以及机会成功的可能性返回所有记录。我报告的所有字段都是必填的,将被填写。我遇到的问题是我的一个关联账户 - “new_dealerid”账户可能并不总是被填写,如果我包括这个我只会得到 31 条记录(他们都有经销商),如果我没有得到 32 (只有新的没有经销商)。那么,如果没有相关帐户,有谁知道如何将此属性默认为空字符串或其他内容?
<request i:type="b:RetrieveMultipleRequest" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<b:Parameters xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<b:KeyValuePairOfstringanyType>
<c:key>Query</c:key>
<c:value i:type="b:FetchExpression">
<b:Query><fetch mapping="logical" version="1.0" >
<entity name="opportunity">
<attribute name="estimatedvalue" />
<attribute name="name" />
<attribute name="new_opportunitytype" />
<attribute name="new_salesphase" />
<attribute name="estimatedclosedate" />
<link-entity name="systemuser" from="systemuserid" to="ownerid">
<attribute name="fullname"/>
</link-entity>
<link-entity name="account" from="accountid" to="new_dealerid">
<attribute name="name"/>
</link-entity>
<link-entity name="account" from="accountid" to="customerid">
<attribute name="name"/>
</link-entity>
<filter type="and">
<condition attribute="salesstagecode" operator="eq" value="'.$prob.'" />
<condition attribute="statuscode" operator="eq" value="1" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="ownerid">
<link-entity name="businessunit" from="businessunitid" to="businessunitid">
<filter type="and">
<condition attribute="name" operator="eq" value="'.$bu.'" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch></b:Query>
</c:value>
</b:KeyValuePairOfstringanyType>
</b:Parameters>
<b:RequestId i:nil="true"/><b:RequestName>RetrieveMultiple</b:RequestName>
</request>