Power Automate List Rows使用Fetchxml查询的一个bug
看一段FetchXML, 这段查询在XRMtoolbox中的fech test工具里执行完全ok
<fetch version="1.0" mapping="logical" distinct="true" no-lock="false">
<entity name="new_projectchange">
<link-entity name="systemuser" alias="aa" link-type="inner" from="systemuserid" to="ownerid">
<link-entity name="new_projectmajorcode" alias="ab" link-type="inner" from="new_projectmajorcodeid" to="new_projectmajorcodeid">
<attribute name="new_purchaseapproval"/>
<link-entity name="systemuser" alias="sys" link-type="inner" from="systemuserid" to="new_purchaseapproval">
<attribute name="internalemailaddress"/>
</link-entity>
</link-entity>
</link-entity>
<filter type="and">
<condition attribute="new_projectchangeid" operator="eq" value="d16d9ba9-fa89-f011-b4cc-002248582342"/>
</filter>
</entity>
</fetch>
但是在list rows的步骤中却执行失败了,提示Key property 'new_projectchangeid' of type 'Microsoft.Dynamics.CRM.new_projectchange' is null. Key properties cannot have null values.
最开始以为是我的condition中的value取值错误,一直是空,但最后哪怕我写死值,还是报一样的错
最后我调整了下语句, 在顶部enitty下面加了一个attribute属性,完美解决。
<fetch version="1.0" mapping="logical" distinct="true" no-lock="false">
<entity name="new_projectchange">
<attribute name="new_projectchangeid"/>
<link-entity name="systemuser" alias="aa" link-type="inner" from="systemuserid" to="ownerid">
<link-entity name="new_projectmajorcode" alias="ab" link-type="inner" from="new_projectmajorcodeid" to="new_projectmajorcodeid">
<attribute name="new_purchaseapproval"/>
<link-entity name="systemuser" alias="sys" link-type="inner" from="systemuserid" to="new_purchaseapproval">
<attribute name="internalemailaddress"/>
</link-entity>
</link-entity>
</link-entity>
<filter type="and">
<condition attribute="new_projectchangeid" operator="eq" value="d16d9ba9-fa89-f011-b4cc-002248582342"/>
</filter>
</entity>
</fetch>