---
title: User query stage
description: This stage queries the managed user repository for a user, based on the supplied query fields. If the stage identifies a user, it populates the mail, userId, userName, and accountStatus fields in state.
component: pingidm
version: 7.5
page_id: pingidm:self-service-reference:stages/stage-user-query
canonical_url: https://docs.pingidentity.com/pingidm/7.5/self-service-reference/stages/stage-user-query.html
keywords: ["JSON", "Configuration", "Authentication", "Self-Service", "User Self-Service"]
---

# User query stage

This stage queries the managed user repository for a user, based on the supplied query fields. If the stage identifies a user, it populates the `mail`, `userId`, `userName`, and `accountStatus` fields in `state`.

* Example configuration

  ```json
  {
      "name" : "userQuery",
      "validQueryFields" : [
          "userName",
          "mail",
          "givenName",
          "sn"
      ],
      "identityIdField" : "_id",
      "identityEmailField" : "mail",
      "identityUsernameField" : "userName",
      "identityServiceUrl" : "managed/user",
      "identityAccountStatusField" : "accountStatus"
  },
  ```

* Dependencies

  This stage has no dependencies on preceding or following stages, but cannot be the only stage in a process.

* Required Parameters

  * `validQueryFields` - an array of fields on which the query can be based.

  * `identityIdField` - the managed object property that contains the user ID to be provided to `state`.

  * `identityEmailField` - the managed object property that contains the user mail to be provided to `state`.

  * `identityUsernameField` - the managed object property that contains the username to be provided to `state`.

  * `identityAccountStatusField` - the managed object property that contains the user account status to be provided to `state`.

  * `identityServiceUrl` - the managed object type on which this stage acts.
