我有这个SQL
查询,我试图从中获取 尚未创建的opportunityId
机会实体(批准文件是另一个实体的名称)。我不认为 fetchxml 支持这种查询。approvaldocument
我是 crm 新手,我的项目是crm 4.0
版本。
这是sql查询:
Select OpportunityId from opportunity AS c left JOIN (select a.opportunitynameid from opportunity o
JOIN ApprovalDocument a ON
a.opportunitynameid=o.OpportunityId) AS b ON c.OpportunityId=b.opportunitynameid
Where b.opportunitynameid IS NULL and statecode=0
我将其转换为 a fetchxml
,但没有给出正确的结果。
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="opportunity"> <attribute name="opportunityid" />
<link-entity name="approvaldocument" from="opportunitynameid" to="opportunityid" alias="a" link-type="outer"> <attribute name="opportunitynameid" />
</link-entity>
<filter type="and">
<condition entityname="a" attribute="opportunitynameid" operator="null" />
</filter>
</entity>
<fetch/>