Namespace

Person

CustomersService#Person

Methods

# static create(body, optionsopt) → {Promise.<ServiceResponse>}

Creates a new Person entity.

Parameters:
Name Type Attributes Description
body Object
data Object

Person field values.

groups Array.<string> <optional>

Group names to add the person to. Names are resolved to humanIds automatically.

employments Array.<{humanId: string, roles: Array.<{role: string, status: ('active'|'paused'|'separated'|'retired'|'inactive')}>}> <optional>

OUs to immediately employ this person in. Each entry must include humanId (the OU's human-readable ID) and a non-empty roles array. Each role entry requires role (string) and status (one of 'active', 'paused', 'separated', 'retired', 'inactive').

options Object <optional>
return boolean <optional>

When true, returns the created entity.

View Source services/CustomersService.class.js, line 298

Promise.<ServiceResponse>
Example
const { result } = await customers.Person.create(
  {
    data: { firstName: 'Ada', lastName: 'Lovelace' },
    groups: ['group-admins'],
    employments: [{ humanId: 'ou-engineering', roles: [{ role: 'Engineer', status: 'active' }] }]
  },
  { return: true }
)

# static delete(humanId) → {Promise.<ServiceResponse>}

Deletes a Person entity.

Parameters:
Name Type Description
humanId string

The person's human-readable identifier.

View Source services/CustomersService.class.js, line 324

Promise.<ServiceResponse>

# static removeEmployment(personHumanId, ouHumanId) → {Promise.<ServiceResponse>}

Removes an employment relationship from a person.

Parameters:
Name Type Description
personHumanId string

The person's human-readable identifier.

ouHumanId string

The OU's human-readable identifier.

View Source services/CustomersService.class.js, line 355

Promise.<ServiceResponse>

# static update(humanId, body) → {Promise.<ServiceResponse>}

Updates an existing Person entity.

Parameters:
Name Type Description
humanId string

The person's human-readable identifier.

body Object

Update payload.

View Source services/CustomersService.class.js, line 312

Promise.<ServiceResponse>

# static upsertEmployment(personHumanId, ouHumanId, roles, optionsopt) → {Promise.<ServiceResponse>}

Adds or updates an employment relationship between a person and an OU.

Parameters:
Name Type Attributes Description
personHumanId string

The person's human-readable identifier.

ouHumanId string

The OU's human-readable identifier.

roles Array.<{role: string, status: ('active'|'paused'|'separated'|'retired'|'inactive')}>

Required. Each entry needs role (string) and status.

options Object <optional>
return boolean <optional>

When true, returns the updated person entity.

View Source services/CustomersService.class.js, line 342

Promise.<ServiceResponse>
Example
await customers.Person.upsertEmployment('person-ada', 'ou-engineering', [
  { role: 'Engineer', status: 'active' }
])