The manager field on sys_user is a reference field that stores the sys_id of another user record. The critical mistake developers make is assuming this field will always have a value — in reality, many user records have no manager assigned, returning null. Additionally, using toString() on a reference field gives you the display value (manager's name), not the sys_id you actually need for queries and assignments.

When to use this

  • Setting assignment rules in Business Rules where you need to assign tickets to the user's manager
  • Building approval workflows that route to the requesting user's direct manager
  • Creating security rules that grant managers access to their direct reports' records
  • Scheduled jobs that need to process organizational hierarchies server-side

When NOT to use this

  • Don't use this in client scripts — use GlideAjax to call a Script Include instead
  • Don't query individual users in a loop — use GlideRecord with addQuery('sys_id', 'IN', arrayOfIds) for bulk operations
  • Don't use this when you need the manager's name or other properties — query once and get all the fields you need
  • Don't assume the current user context in scheduled jobs — explicitly pass the user sys_id

Key behaviors and gotchas

  • The manager field returns null when empty, not an empty string — always use getValue() and check for null
  • User ACLs can prevent you from reading another user's manager field — test with different role contexts
  • Domain separation affects which user records you can query — managers in other domains may not be accessible
  • The manager field is indexed, making single-user lookups fast, but avoid querying by manager in loops
  • Inactive users can still be managers — the reference doesn't validate the manager's active status
  • Circular manager relationships are possible in the data — validate before creating automatic assignment chains
⚠️

Never use current.manager.toString() to get the sys_id. This returns the manager's display name (usually their full name), not the sys_id. Use getValue('manager') to get the actual reference value you can use in queries and assignments.