> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/xsoar-6-administrator-guide/6.12/onboard-cortex-xsoar/onboarding-in-cortex-xsoar/users-and-roles/user-management/clear-users-data-using-a-playbook.md).

# Clear Users Data Using a Playbook

After you [remove a user](/xsoar-6-administrator-guide/6.12/onboard-cortex-xsoar/onboarding-in-cortex-xsoar/users-and-roles/user-management/remove-a-user.md) from Cortex XSOAR, you also need to clear the data. You can decide which user can replace the deleted user. You can do this by running a command manually in the CLI or automating the process using a playbook or through server configurations.

If running a command in the CLI or in a playbook, you must set the **`builtin.commands.hidden.clearUsersData`** server configuration to **`false`**, otherwise the command cannot run.

{% hint style="info" %}

### Note

* When clearing users' data, only active incidents and incidents are cleared. Incidents that have been closed are not changed.
* Any invitation created by a deleted user is removed. If the deleted user is the invitee, the invite remains in the Invites table.
  {% endhint %}

Before you begin, ensure you [remove the user](/xsoar-6-administrator-guide/6.12/onboard-cortex-xsoar/onboarding-in-cortex-xsoar/users-and-roles/user-management/remove-a-user.md), otherwise, you may receive an error when running the playbook.

1. Create a list of users you want to remove.
   1. Select **Settings** → **ADVANCED** → **Lists** → **Add a List**.
   2. Add a name for the list.
   3. In the **Content Type** field, select **Text**.
   4. Add the names of the users.

      If adding multiple names use separate lines for each name.
   5. Add the permission level.

      For example, for Read Only, you may want only read-only users to be able to see the list but for Read and edit, you may want both analyst and administrator to be able to edit.
   6. Save the list.
2. Add the following server configurations by going to **Settings** → **ABOUT** → **Troubleshooting** → **Add Server Configuration**.

   | Key                                          | Description                                                                                                                                                                                                                                                                                                                                      |
   | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
   | **`builtin.commands.hidden.clearUsersData`** | Set to **`false`** to run the **`clearUserData`** command in the CLI and playbook. Default is **`true`**.                                                                                                                                                                                                                                        |
   | **`server.mask.git.commits`**                | <p>Set to <strong><code>true</code></strong> to remove the users data from the git commit version that the user created (version control). For an example of version control in a playbook, see <a href="/spaces/9gZ0C5CI8Bl5Aulkp4dZ/pages/OZwSXupIGPbWrXXqEBE9">Version Control</a>.</p><p>Default is <strong><code>false</code></strong>.</p> |
3. Create a playbook to remove the user's data.
   1. Select **Playbooks** → **New Playbook**
   2. Add a name for the playbook and click Save.
   3. Create a Task.
   4. In the Automation field, select the clearUsersData (Builtin) automation.
   5. Add the following inputs.

      | Argument        | Description                                                                 |
      | --------------- | --------------------------------------------------------------------------- |
      | **`listName`**  | Name of the list you created in step 1.                                     |
      | **`username`**  | The name of the replacement user. Default is admin.                         |
      | **`listClear`** | Set to true to delete the list after the data is cleared. Default is false. |
   6. Save the task.
   7. (Optional) Run the debugger to test the playbook.
4. Create a job to run the playbook.
   1. Select **Jobs** → **New Job**.

      By default, the Time-triggered job is already selected.
   2. Select the time you want to run the job.
   3. Add the [Time Triggered Job Parameters](/xsoar-6-administrator-guide/6.12/configure-cortex-xsoar/customize-and-configure-cortex-xsoar/jobs/time-triggered-job-parameters.md).

      You need to add the playbook created in step 3.
   4. Save the job.

      The next time the job is scheduled to run, the user's data is deleted.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/xsoar-6-administrator-guide/6.12/onboard-cortex-xsoar/onboarding-in-cortex-xsoar/users-and-roles/user-management/clear-users-data-using-a-playbook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
