locked
CRM 2011 - FetchXML - Reports - Retrieving Data From Related Entities RRS feed

  • Question

  • I have 2 entities - "VehicleJobForm" and "VehicleJobs". This is a 1:N relationship. Where I can have multiple "VehicleJobs" related to a single"VehicleJobForm". The related lookupfield is called "c2_jobsid".

    I am trying to create a report where a user can click a "VehicleJobForm" record and click run report. Which will show specific information related to that single record. ( This works ). AND to show information/columns of the related entity "VehiceJobs"

    This is my FetchXML

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="c2_vehiclejobform" enableprefiltering="1">
        <attribute name="c2_vehiclejobformid" />
        <attribute name="c2_name" />
        <attribute name="createdon" />
        <attribute name="c2_vehicleyear" />
        <attribute name="c2_vehiclemodel" />
        <attribute name="c2_vehiclemake" />
        <attribute name="c2_vehicle" />
        <attribute name="c2_totalsupplyrrp" />
        <attribute name="c2_totalsupplycost" />
        <attribute name="c2_totalprice" />
        <attribute name="c2_totallabourrrp" />
        <attribute name="c2_totallabourcost" />
        <attribute name="c2_totalcost" />
        <attribute name="c2_supplyvat" />
        <attribute name="c2_supplycost" />
        <attribute name="c2_registrationno" />
        <attribute name="c2_mobilephone" />
        <attribute name="c2_labourvat" />
        <attribute name="c2_labourcost" />
        <attribute name="c2_hoursworked" />
        <attribute name="c2_enginetype" />
        <attribute name="c2_enginesize" />
        <attribute name="c2_date" />
        <attribute name="c2_customer" />
        <order attribute="c2_name" descending="false" />
    	<link-entity name="c2_vehiclejobs" from="c2_jobsid" to="c2_jobsid" visible="false" link-type="outer" alias="c2_jobsid">
    		<attribute name="c2_name"/>
    	</link-entity>
    
      </entity>
    </fetch>

    When i try to preview the reports in visual studio i get this error:

    'c2_vehiclejobform' entity doesn't contain attribute with Name = 'c2_jobsid'.

     

     



    • Edited by KKHAN1991 Wednesday, July 24, 2013 12:37 PM
    Wednesday, July 24, 2013 12:36 PM

Answers

  • Hi i managed to fix it, VehicleJobForm, did not have the field. I used a diff field, shown on the relationship and it worked

    • Marked as answer by KKHAN1991 Thursday, July 25, 2013 9:39 AM
    Thursday, July 25, 2013 9:38 AM

All replies

  • Are you certain the "c2_vehiclejobform" entity has a field named "c2_jobsid"?

    Have you created the query using Advanced Find and grabbed the FetchXML to make sure everything is correct?


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, July 24, 2013 1:38 PM
    Moderator
  • Hi i managed to fix it, VehicleJobForm, did not have the field. I used a diff field, shown on the relationship and it worked

    • Marked as answer by KKHAN1991 Thursday, July 25, 2013 9:39 AM
    Thursday, July 25, 2013 9:38 AM