{{tag> topic lrt role roles csv delete bulk scheduler idm-core }}
====== Delete roles from CSV ======
IdStory allows bulk delete of roles defined in a CSV file. The action runs as a standard
long running task (LRT) started from the scheduler. Roles are deleted one by one - the
result of every row is logged to a processed item, so you can review which roles were
deleted and why a role could not be deleted (for example because it is still assigned to
an identity).
{{.:pasted:20260524-154438.png}}
===== Configuration =====
* **Import file** - drag and drop the CSV file with the list of role codes to delete. The CSV can contain other (unused) columns. Required.
* **separator** - column separator used in the CSV file. Default is `;`.
* **encoding** - CSV file encoding. Default is `utf-8`.
* **Column with role codes** - name of the column that contains the role codes. Required.
* **Force delete** - delete roles together with all related records (role assignments, automatic role definitions, business roles, etc.). See the note below.
⚠️ **Force delete** is a destructive operation - it removes the role even if it still has
related records (assignments, automatic role definitions, business roles, ...). Run it
only when you are sure these records should be removed as well.
===== Behavior =====
* The CSV is expected to have a header row. The first record is checked for the configured role code column - if the column is not found, the task logs a failed item and stops processing.
* For every row the role is looked up by its code:
* If no role with the given code exists, the row is logged as **failed** and processing continues with the next row.
* If the role exists, it is deleted (see the two modes below).
* Each processed row produces one item in the task detail with the result (completed / failed) and a message.
==== Standard delete ====
Without **Force delete** the role is deleted via the standard ,
which runs all related processors and validations. If the role cannot be deleted (for
example it is still assigned to an identity), the item is logged as failed and the role
is kept.
==== Force delete ====
With **Force delete** enabled the role is removed together with all related records. The
actual cleanup runs at the end of the task: for every role marked for force delete IdStory
re-checks whether the role has been assigned to a user again in the meantime - if so, the
role is **not** deleted and the item is logged as failed. Otherwise the role and all its
states are removed.
The task is **recoverable** - it can be restarted from the scheduler and continues with
the original CSV attachment.