<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D5KZ00001WaXEo0ANOkta Classic EngineAutomationsAnswered2025-11-28T18:08:38.000Z2025-11-07T22:34:34.000Z2025-11-28T18:08:38.000Z

TomC.75736 (Peninsula College) asked a question.

Delete users who have been deprovisioned for over 12 months

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.


  • TimL.58332 (Workflows)

    @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.

     

    • id
    • status
    • created
    • activated
    • statusChanged
    • lastUpdated

     

     

    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.

     

    image

    Expand Post
    Selected as Best
  • Paul S. (Okta, Inc.)

    Hello @TomC.75736 (Peninsula College)​ Thank you for posting on our Community page!

     

    The Okta Community Questions forum isn't really meant for in-depth troubleshooting.

    I would recommend opening a Support ticket, then continuing the discussion with the assigned Technical Support Engineers. They'll be able to access additional tools and resources to help you get to the bottom of it.

     

    Thank you for reaching out to our Community and have a great day!

    --

    Help others in the community by liking or hitting Select as Best if this response helped you.

    Expand Post
  • TimL.58332 (Workflows)

    @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.

     

    • id
    • status
    • created
    • activated
    • statusChanged
    • lastUpdated

     

     

    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.

     

    image

    Expand Post
    Selected as Best
This question is closed.
Loading
Delete users who have been deprovisioned for over 12 months