Retrieving User Properties

The following JavaScript utility functions are provided for accessing the logged-in user’s properties and user roles. These functions will only provide relevant information after a user has logged-in.


This function returns data for the logged-in Account. See the table below for how the information is returned. If a user is not logged-in, the string “No user found” will be returned.


Data in connected User Roles will need to be accessed separately via an API request.

emaila string of the logged-in user’s email
ida string of the logged-in user’s record id
namea string of the logged-in user’s name
rolesan array of object-keys that the user is assigned to ["object_1", "object_2"]
valuesthe complete values from the Account record, indexed by field {field_1: "[email protected]", field_2: "Tester"}
  id: "5a5ce0c75954805576173519",
  values: {…},
  roles: Array(1),
  email: "[email protected]",
  name: "Amy Adams"

This function also allows you to grab individual pieces, if not all information is needed:

//"[email protected]"

Custom fields added to the top-level Account object can be accessed using object notation on the values attribute (individual user role object fields are not accessible here):

// Change field_1 to the field key of the field you want to retreive
//"my custom field value"


Returns the logged-in user's token (string).



When no parameter is provided, this function returns an array of object keys representing the user roles to which the user is assigned.

Knack.getUserRoles(); // ['object_1', 'object_2']

If you pass in an object key - as a string - this function will return true if the user has access to that role, or false if not:

Knack.getUserRoles('object_1'); // true