Many a times there's a requirement on querying the data from entity and joining the data with the linked entity as well.
e.g. If i have a "Student Event" entity in the CRM system which has a many to one relationship with the "Student" event and if i want to display the "Student Event " details on my UI then obviously i would want to display the "name" attribute of the student on the UI as well. Now if i use RetriveMultiple method to get these details it would take more then one hit on the CRM Server to get all the relevant data.
To avoid the round trip on the server i can instead use FetchXml method on the CRM Web service. This method would return all the data to me in the form of xml.
The method takes xml query as input and this xml can be formed using a Stunnware tool which can be downloaded here.
Using this tool we can easily create and test the xml which has to be passed to FetchXml method. However there's a catch. If you use this tool to generate the fetch xml it would generate an xml which would look like
<fetch count="50" mapping="logical" version="1.0">
<link-entity from="studentid" name="student" to="studentid">
and when you execute FetchXml API using this xml you would get all the attributes of the student event entity to be returned however the attributes of the student would not be returned.
To solve this you need to manually edit the xml and add an alias attribute to the linkentity student. So the final xml should look something like
<fetch mapping="logical" count="50" version="1.0">
<link-entity name="student" from="studentid" to="studentid" alias="studentdetails">
and this would get you the attributes of studentdetails entity as well.
This may be a bug in the stunnware tool or may be because it was buit to be used against CRM 4.0. Otherwise the tool is an excellent way to generate the xml to query the CRM System with linked entities.