Antylogic
DemoApp login

399 operational guides

Docs sections
DocsTeam
Device

Delete a Staff Role

Remove an unused staff role from Harbor Soho when no active staff member is assigned. Antylogic lets managers start from the roles list or role detail page, and blocks assigned roles at deletion time.

In this article

Staff roles are location setup records. In Harbor Soho, delete a role only when it no longer represents an active operating position and no active employee is assigned to it.

The Employee roles list can warn or disable deletion when staff assignment data is available, but the backend remains the final authority. If an assigned role is submitted from the detail page, Antylogic keeps the role and shows an assigned-role error.

Before you start

  • You are signed in to Harbor Demo Group with Harbor Soho selected as the current location.
  • Your location permissions include `staff-roles:manage`; `staff-roles:view` lets you review roles but does not show delete controls.
  • The role exists in Harbor Soho.
  • No active staff member is assigned to the role. Reassign, unlink, or archive affected staff before deleting.
  • Organisation and location context are available so the app can target the current `orgId` and `locationId`.

Instructions

  1. 1.

    Open Employee Roles

    Go to Staff and open Employee roles. Review the role name, description, and Employees column. In the demo runtime, use the `STAFF_ROLE_LIST_QUERY` value `Sala` to narrow the list.

  2. 2.

    Check Assignments

    Use the Employees column to verify whether active staff use the role. If active staff are assigned, clear those assignments first by reassigning, unlinking, or archiving the affected staff records.

  3. 3.

    Start Delete

    For a role with no active staff assigned, choose Delete from the role row or open the role detail page and use Delete in the footer. Antylogic opens the Delete role confirmation dialog with the selected role name.

  4. 4.

    Confirm Delete

    Select Delete to submit the removal, or Cancel to keep the role. The delete action removes one role at a time and sends no extra form fields or confirmation payload.

  5. 5.

    Verify Result

    On success, the dialog closes, the roles list refreshes, the detail cache is cleared, and a Role deleted toast names the removed role. If active assignments exist, Antylogic shows Unable to delete role / You can't delete a role that is assigned.

Validations and limits

  • Deletion targets `DELETE /api/app/{orgId}/{locationId}/staff-roles/{roleId}` and returns `204 No Content` on success.
  • `staff-roles:manage` is required at location scope; view-only users cannot delete.
  • The role must belong to the selected location. Empty, missing, or cross-location role ids resolve as not found.
  • Active staff with `staff.staff_role_id` equal to the role id block deletion. Staff records already archived with `deleted_at` do not block it.
  • The table warning depends on staff data being loaded; the backend always enforces `error.staff_role.delete_assigned` for assigned roles.
  • Deleting a staff role is a physical delete of `staff_roles`; there is no documented restore flow.

Expected result

The unused role is removed from Harbor Soho, disappears from the roles list and detail view, and active assigned roles remain protected until their staff assignments are cleared.

Related articles