User: Get Node

The User: Get Node allows a workflow to retrieve one or more Experience Users from the current application and add them to the current workflow payload.

User: Get Node

Node Properties

Query Method

User: Get Node Query

There are two ways to query for experience users using this node - both support templating.

  • Email/ID: Either a user’s ID or a user’s email. The node will automatically determine which it is based on the form of the input.
  • Tag Query: Give a set specific tag key/value pairs to retrieve one or more groups. Any group(s) returned will match all tags in the query.

    You may also query by key only or value only. If a key is set without a value, any device that has that key set regardless of the value will be returned. If a value is set without a key, any device that has that value set regardless of the key will be returned.

Configuration

User: Get Node Config

If Tag Query is selected as the query method, you will be able to input the tag key/value pairs to find a user or multiple users.

Results Configuration

User: Get Node Result Config

If Tag Query is selected as the query method an extra set of properties will appear beside the tags input:

  • Return multiple users?: If you want to return multiple users from this query, check this box. This also alters the return type of the result. If checked and nothing is found, an empty array will be returned instead of null. If checked and one or more users have been found they will be returned as an array.
  • Results Per Page: This templatable input is the maximum number of users to return with one query. The max number of users that can be returned at once is 1000. The default is 100.
  • Page Number: This is a templatable input that resolves to a number. This number must be greater than 0, and the default is 0. This defines the number of results to skip by multiplying this number by the Results per Page field.
  • Sort Field: This is the field on the group to sort the results by. By default, this field is email. The following are the valid sort fields: email, id, first name, last name, creationDate or lastUpdated.
  • Sort Direction: This is the field that tells the sort field which direction to sort in. By default, this field is Ascending.

NOTE: Sorting options affect the result — even when returning a single user.

  • Metadata: You will also have the option to return metadata in addition to the queried users.

    • Return just an array of results - The User: Get Node’s result will be an array of users.
    • Return an object containing metadata along with results - The User: Get Node’s result will be an object with keys for metadata properties in addition to an array of users in the items key.

An example of the User: Get Node’s metadata can be found in the Node Example.

Result Path

User: Get Node Result

The query result will be stored at the payload path provided in the Result Path field. If the query is configured to potentially return multiple users, this will always be an array, even if no users are found. If the query is only returning a single user (which is always the case for email/ID queries), this will either be the user object or will be null.

Node Example

In the example above, the workflow will retrieve any users that has the externalId tag matching the value at data.query.systemId on the payload, and will place the resulting users at working.userResult.

For example, the payload after the User: Get Node runs might look like the following:

{
  "data": {
    "query": {
      "systemId": "myExternalSystemId"
    }
  },
  "working": {
    "userResult": [{
      "email": "test.user@example.com",
      "firstName": "Test",
      "lastName": "User",
      "applicationId": "58dc4ec29e8df60001fbea01",
      "creationDate": "2017-03-30T00:18:23.902Z",
      "lastUpdated": "2017-03-30T00:18:59.019Z",
      "userTags": {
        "externalId": "myExternalSystemId"
      },
      "passwordLastUpdated": "2017-03-30T00:18:23.903Z",
      "lastLogin": "2017-03-30T00:18:59.015Z",
      "experienceUserId": "58dc4ecf9e8df60001fbea0a",
      "id": "58dc4ecf9e8df60001fbea0a",
      "experienceGroups": [
        {
          "id": "58dc4ece9e8df60001fbea02",
          "name": "My Example Group"
        }
      ]
    }],
    ...
  },
  ...
}

If querying for multiple users with metadata, the result will look like the following:

{
  "working": {
    "userResult": {
      "count": 100, // The number of users returned
      "tagQuery": { ... }, // The query used to find users
      "findMethod": "userTags", // The selected find method
      "perPage": 100,
      "page": 0,
      "totalCount": 193, // The number of users matched by the query
      "sortField": "creationDate",
      "sortDirection": "desc",
      "items": [ ... ] // The resulting users from the query
    }
  },
  ...
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.