Having spent days gradually reducing the code to isolate the problem, I am clearly doing something fundamentally wrong in the way I am constructing a FetchXML structure to filter a Subgrid. This xml works fine in XRMToolbox but fails when I run it in Dynamics with the error "Link entity with name or alias LearnEvent is not found"
<fetch>
<entity name='crd80_flightplanevent'>
<attribute name='crd80_flightplanevent' />
<attribute name='crd80_specificday' />
<attribute name='crd80_windowfinish' />
<attribute name='crd80_windowstart' />
<filter type='and'>
<condition attribute='crd80_learnerflight' operator='eq' value='01446622-C4ED-42AF-BA56-20D39324B2F8'/>
<condition entityname='LearnEvent' attribute='crd80_learningeventid' operator='eq' value='8795c5e6-f042-ed11-bba3-0022489b43c0'/>
</filter>
<link-entity name='crd80_learningevent' from='crd80_learningeventid' to='crd80_learningevent' link-type='outer' alias='LearnEvent' />
</entity>
</fetch>
Any suggestions, please?