locked
Use time aspect of DateTime in FetchXML filter RRS feed

  • Question

  • I'm trying to retrieve all records that have been modified since a certain time in a plugin. The following FetchXML appears correct when I can it being generated:

    <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
      <entity name='account'>
        <attribute name='name' />
        <attribute name='address1_line1' />
        <attribute name='telephone1' />
        <attribute name='c20_update' />
        <attribute name='websiteurl' />
        <filter type='and'>
          <filter type='or'>
            <condition attribute='c20_update' operator='null' />
            <condition attribute='c20_update' operator='on-or-after' value='9/2/2014 4:30:00 PM' />
          </filter>
          <condition attribute='tickersymbol' operator='eq' value='ABC' />
        </filter>
      </entity>
    </fetch>

    However it returns the following record (convert to an xml string for transport)

    <?xml version='1.0' encoding='UTF-8'?>
    <account>
      <name>A. Datum Corporation (sample)</name>
      <address1_line1>2137 Birchwood Dr</address1_line1>
      <telephone1>555-015888</telephone1>
      <c20_update>9/2/2014 2:05:02 PM</c20_update>
      <websiteurl>http://www.adatum.com/</websiteurl>
      <accountid>c4d0a989-482e-e411-a7f7-6c3be5be1fec</accountid>
      <address1_composite>2137 Birchwood Dr</address1_composite>
    </account>

    I have tried with a custom date field and with the modifiedon field, but in both cases it seems to only account for the date aspect, not the time. Is there a better/correct way of handling this?


    Wednesday, September 3, 2014 12:36 PM

Answers

  • on-er-after only takes the date, not the time. Use 'gt'.
    • Proposed as answer by Guido PreiteMVP Wednesday, September 3, 2014 2:31 PM
    • Marked as answer by ChrisJC119 Wednesday, September 3, 2014 3:16 PM
    Wednesday, September 3, 2014 2:09 PM