Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16999

Using the API for searching on a custom datetime field with '<=' operator throws error

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.6.6
    • Fix Version/s: None
    • Component/s: CiviCRM API
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Suppose you have a custom datetime field on contacts, and you want to search all contacts that have a date in this field that is earlier than some given date, like e.g.

          $result = civicrm_api3('Contact', 'get', array(
            'sequential' => 1,
            'custom_2' => array('<=' => "2015-08-31"),
          ));
      

      Then you get this unrelated error message:

          {
              "is_error": 1,
              "error_message": "The field 'custom_2' has no associated option list."
          }
      

      I am aware of the fact that the custom fields you provide to the api are currently ignored (CRM-16036), but this issue seems to be unrelated.
      UPDATE: searching on custom fields does work for contacts.

      I will upload a unit test in a minute.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              johanv Johan Vervloet
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: