<fetch>
  <entity name="account">
    <all-attributes />
    <link-entity name="contact" from="parentcustomerid" to="accountid" alias="contacts" link-type="outer">
      <attribute name="fullname" />
      <attribute name="jobtitle" />
      <attribute name="emailaddress1" />
      <attribute name="telephone1" />
      <filter type="and">
        <condition attribute="statecode" operator="eq" value="0" />
      </filter>
      <order attribute="fullname" />
    </link-entity>
    <link-entity name="opportunity" from="parentaccountid" to="accountid" alias="opportunities" link-type="outer">
      <attribute name="name" />
      <attribute name="estimatedvalue" />
      <attribute name="estimatedclosedate" />
      <attribute name="closeprobability" />
      <attribute name="stepname" />
      <filter type="and">
        <condition attribute="statecode" operator="eq" value="0" />
      </filter>
      <order attribute="estimatedclosedate" />
    </link-entity>
  </entity>
</fetch>
