locked
Fetch XML query RRS feed

  • Question

  • Can anybody help in adapting this query to only report 'active' contacts linked to an account

    <fetch distinct="false" no-lock="false" mapping="logical">
     <entity name="account" enableprefiltering="1" prefilterparametername="CRM_FilteredAccount">
      <attribute name="name" alias="name" />
      <attribute name="new_companyname" alias="new_companyname" />
      <attribute name="telephone1" alias="telephone1" />
      <attribute name="accountid" />
       <link-entity name="contact" to="accountid" from="parentcustomerid" link-type="outer" alias="contact1" enableprefiltering="1" prefilterparametername="CRM_FilteredContact">
        <attribute name="fullname" alias="contact1_fullname" />
        <attribute name="jobtitle" alias="contact1_jobtitle" />
        <attribute name="telephone1" alias="contact1_telephone1" />
        <attribute name="new_ext" alias="contact1_new_ext" />
        <attribute name="new_outofhours" alias="contact1_new_outofhours" />
        <attribute name="emailaddress1" alias="contact1_emailaddress1" />
        <attribute name="mobilephone" alias="contact1_mobilephone" />
        <attribute name="new_webappid" alias="contact1_new_webappid" />
        <attribute name="new_viewall" alias="contact1_new_viewall" />
        <attribute name="new_ismaster" alias="contact1_new_ismaster" />
        <attribute name="new_persubmit" alias="contact1_new_persubmit" />
        <attribute name="new_restrictedview" alias="contact1_new_restrictedview" />
        <attribute name="new_importfiles" alias="contact1_new_importfiles" />
        <attribute name="new_manualtransactions" alias="contact1_new_manualtransactions" />
        <attribute name="telephone2" alias="contact1_telephone2" />
        <attribute name="new_clientmaster" alias="contact1_new_clientmaster" />
        <attribute name="new_authorise" alias="contact1_new_authorise" />
        <attribute name="new_addaccounts" alias="contact1_new_addaccounts" />
        <attribute name="contactid" />
       </link-entity>
     </entity>
    </fetch>


    Dont ask me .. i dont know

    Thursday, August 15, 2013 12:10 PM

Answers

  • <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="contact">
        <attribute name="fullname" />
        <attribute name="telephone1" />
        <attribute name="contactid" />
        <order attribute="fullname" descending="false" />
        <filter type="and">
          <condition attribute="statecode" operator="eq" value="0" />
          <condition attribute="parentcustomerid" operator="eq" uitype="account" value="{749CFFD5-6B86-E211-8A6B-3C4A92DBDC39}" />
        </filter>
      </entity>
    </fetch>


    Regards Faisal

    • Marked as answer by Pete Newman Thursday, August 15, 2013 12:41 PM
    Thursday, August 15, 2013 12:35 PM