<fetch>
  <entity name="incident">
    <all-attributes />
    <link-entity name="contact" from="contactid" to="primarycontactid" alias="primarycontact" link-type="outer">
      <attribute name="fullname" />
      <attribute name="emailaddress1" />
      <attribute name="telephone1" />
    </link-entity>
    <link-entity name="activitypointer" from="regardingobjectid" to="incidentid" alias="activities" link-type="outer">
      <attribute name="subject" />
      <attribute name="activitytypecode" />
      <attribute name="statecode" />
      <attribute name="createdon" />
      <order attribute="createdon" descending="true" />
    </link-entity>
  </entity>
</fetch>
