
GuyS.49159 (Customer) asked a question.
Hello,
I have a script that creates a user for tests. It adds them to a "test user" group that I created. I added a workflow that deactivates all inactive users (after the test is over, 1 day after they will count as inactive, so this is good enough for me) from the "test user" group, which is great. Now I am wondering if there's a way to actually just delete those users? Sadly, the workflow says it will "delete" but it simply deactivates them. I previously asked a question about whether those deactivated users will count towards the 10,000 per month user quota and been told that since they are deactivated, they don't count, but to be sure i'd still like to delete them instead. Is there a way to delete all users from a group / all deactivated users from a group / just all deactivated users in general on a regular basis?

"Deleting" a user is staged just like if you were manually doing it through the GUI. To delete a user you have to deactivate them first (one API call) then delete them (second API call)
See the API documentation for Delete User: https://developer.okta.com/docs/reference/api/users/#response-example-29
So if you were to make a flow it would look something like:
1). Locate all users meeting X criteria (in your case inactive)
2). Use a "for each" to call a child flow
3). In the child flow perform a deactivate, then a delete