
TomC.75736 (Peninsula College) asked a question.
I have created two workflows that search for Deprovisioned users and deletes them. They work great.
Now I am trying to fine tune it to only delete the users who have been deprovisioned for over 12 months. What would be the best way to filter out those users before sending to the delete flow.

@TomC.75736 (Peninsula College) -- You would leverage "list users" to search for users that meet your criteria. The statusChanged attribute is one of the indexed attributes that contains an ISO 8601 format. Here is a list from the API documentation of the attributes that are indexed.
https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/listUsers
Here's an example of top level attribute values returned:
"id": "00xxxxxxxxxxxxx5d7",
"status": "STAGED",
"created": "2021-10-01T20:56:58.000Z",
"activated": "2021-10-01T20:56:59.000Z",
"statusChanged": "2021-10-01T22:42:05.000Z",
"lastLogin": null,
"lastUpdated": "2024-03-06T01:02:12.000Z",
"passwordChanged": "2021-10-01T20:56:58.000Z",
You could search for users that are DEPROVISIONED && statusChanged older than 365 days for example.
The following screenshot is an example for the query that pulled up the STAGED user above. If you notice i have a really old greater than (gt). I recommend having it be decades back. Having both lt and gt removes all "null" dates. For DEPROVISIONED I think there is "always" a statusChanged value since users can't start in that user state. However, to be safe its a good idea to account for possibilities.