Uploaded image for project: 'OpenICF'
  1. OpenICF
  2. OPENICF-956

ServiceNow: greater operator 'gt' in queryFilter doesn't work correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: servicenow-connector-1.5.0.0
    • Component/s: ServiceNow Connector
    • Labels:
    • Environment:

      Description

      'gt' query filter doesn't work correctly, because the request can return lesser value.

      Steps to reproduce:

      1. Download, unzip openidm, start openidm and set up ServiceNow connector according documentation
      2. Send POST request - create user 'gt_153744455303'
        curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --header "Content-Type: application/json" --data '{"email": "GroupTest@example.com", "description": "Group - Test", "name": "gt_153744455303"}' --request POST "http://localhost:8080/openidm/system/serviceNow/group?_action=create"
      3. Send GET request with 'gt queryFilter = name gt "gt_153744455302"'
        curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --request GET "http://localhost:8080/openidm/system/serviceNow/group?_queryFilter=%2Fname+gt+%22gt_153744455302%22&_fields=name" | jq
        
        Example respomse:
        {
          "result": [
            {
              "_id": "10",
              "name": "RMA Approvers"
            },
            {
              "_id": "20",
              "name": "Network"
            },
            {
              "_id": "30",
              "name": "Network CAB Managers"
            },
            {
              "_id": "40",
              "name": "IT Securities"
            },
            {
              "_id": "60",
              "name": "NY DB"
            },
            {
              "_id": "70",
              "name": "Procurement"
            },
            {
              "_id": "90",
              "name": "Software"
            },
            {
              "_id": "100",
              "name": "Hardware"
            },
            {
              "_id": "120",
              "name": "Project Mgmt"
            },
            {
              "_id": "140",
              "name": "Team Development Code Reviewers"
            },
            {
              "_id": "150",
              "name": "Service Desk"
            },
            {
              "_id": "160",
              "name": "LDAP Admins"
            },
            {
              "_id": "161",
              "name": "gt_153744455303"
            }
          ],
          "resultCount": 13,
          "pagedResultsCookie": null,
          "totalPagedResultsPolicy": "NONE",
          "totalPagedResults": -1,
          "remainingPagedResults": -1
        }
        

      Expected result: Result should contain only records which 'name' attribute have greater value than 'gt_153744455302' (e.g. 'gt_153744455303').
      For example above then result should look like:

      { "result": [{
            "_id": "161",
            "name": "gt_153744455303"
          }
        ],
        "resultCount": 1,
        "pagedResultsCookie": null,
        "totalPagedResultsPolicy": "NONE",
        "totalPagedResults": -1,
        "remainingPagedResults": -1
      }

      Actual result: Result contained records which had lesser value than 'gt_153744455302' for 'name' attribute.

      Note: I think that it could be due to comparing lower values of this attribute.

      name_array = ['RMA Approvers', 'Network', 'Network CAB Managers', 'IT Securities', 'NY DB', 'Procurement', 'Software', 'Hardware', 'Project Mgmt', 'Team Development Code Reviewers', 'Service Desk', 'LDAP Admins', 'gt_153744455303']
      less_value = 'gt_153744455302'
      
      for item in name_array:
          print(f'"{item}" > "{less_value}" ===> Result: {item > less_value}'
          print(f'"{item.lower()}" > "{less_value}" ===> Result: {item.lower() > less_value}'
      

      then output for above python code is:

      "RMA Approvers" > "gt_153744455302" ===> Result: False
      "rma approvers" > "gt_153744455302" ===> Result: True
      "Network" > "gt_153744455302" ===> Result: False
      "network" > "gt_153744455302" ===> Result: True
      "Network CAB Managers" > "gt_153744455302" ===> Result: False
      "network cab managers" > "gt_153744455302" ===> Result: True
      "IT Securities" > "gt_153744455302" ===> Result: False
      "it securities" > "gt_153744455302" ===> Result: True
      "NY DB" > "gt_153744455302" ===> Result: False
      "ny db" > "gt_153744455302" ===> Result: True
      "Procurement" > "gt_153744455302" ===> Result: False
      "procurement" > "gt_153744455302" ===> Result: True
      "Software" > "gt_153744455302" ===> Result: False
      "software" > "gt_153744455302" ===> Result: True
      "Hardware" > "gt_153744455302" ===> Result: False
      "hardware" > "gt_153744455302" ===> Result: True
      "Project Mgmt" > "gt_153744455302" ===> Result: False
      "project mgmt" > "gt_153744455302" ===> Result: True
      "Team Development Code Reviewers" > "gt_153744455302" ===> Result: False
      "team development code reviewers" > "gt_153744455302" ===> Result: True
      "Service Desk" > "gt_153744455302" ===> Result: False
      "service desk" > "gt_153744455302" ===> Result: True
      "LDAP Admins" > "gt_153744455302" ===> Result: False
      "ldap admins" > "gt_153744455302" ===> Result: True
      "gt_153744455303" > "gt_153744455302" ===> Result: True
      "gt_153744455303" > "gt_153744455302" ===> Result: True

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                petr.jurica Petr Jurica [X] (Inactive)
                Reporter:
                miroslav.meca Miroslav Meca
                QA Assignee:
                Miroslav Meca
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: