-
-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Hi there,
I'm having issues with the following OData conversion.
For a 1 - Many relationship between Opportunity and "Opportunity Items", I want to select all records where the Opportunity Item ID matches a list of ID's and the parent Opportunity is in a list of stages (option set values).
The FetchXml looks like this, and works as expected:
<fetch top='1'>
<entity name='fmi_opportunityitem'>
<attribute name='fmi_name' />
<attribute name='fmi_opportunityitemid' />
<filter>
<condition attribute='fmi_opportunityitemid' operator='in'>
<value>3c0c5808-4d73-ef11-a670-00224800e326</value>
<value>6f0d3ad4-4773-ef11-a670-002248c87217</value>
</condition>
</filter>
<link-entity name='opportunity' from='opportunityid' to='fmi_opportunityid' alias='opp'>
<filter>
<condition attribute='fmi_stage' operator='in'>
<value>797300000</value>
<value>797300001</value>
</condition>
</filter>
</link-entity>
</entity>
</fetch>
FXB gives me this OData:
...fmi_opportunityitems?$select=fmi_name,fmi_opportunityitemid&$expand=fmi_OpportunityId($select=opportunityid)&$filter=(Microsoft.Dynamics.CRM.In(PropertyName='fmi_opportunityitemid',PropertyValues=['3c0c5808-4d73-ef11-a670-00224800e326','6f0d3ad4-4773-ef11-a670-002248c87217'])) and (fmi_OpportunityId/Microsoft.Dynamics.CRM.In(PropertyName='fmi_stage',PropertyValues=['797300000','797300001']))&$top=1
which returns this error:
"message": "'fmi_opportunityitem' entity doesn't contain attribute with Name = 'fmi_stage'
which, of course is true, because the column fmi_stage is on Opportunity.
Using Rest Builder I've managed to get something working - this uses the 'this or this or this' syntax, rather than the 'IN' syntax:
$select=fmi_name&$expand=fmi_OpportunityId($select=name)&$filter=((fmi_opportunityitemid%20eq%203c0c5808-4d73-ef11-a670-00224800e326%20or%20fmi_opportunityitemid%20eq%206f0d3ad4-4773-ef11-a670-002248c87217)%20and%20(fmi_OpportunityId/fmi_stage%20eq%20797300000%20or%20fmi_OpportunityId/fmi_stage%20eq%20797300001))&$top=1
I'm not sure if this is fixable - may be a limitation of the webapi rather than an issue with FXB.