none
Understand workflow auto clean up job

    Question

  • Hi,

    I have created some workflows 2013  (with workflow manager) and I have a question about the workflow clean up.

    In my workflows, I have custom tasks lists associated to it with differents custom content type that inherit from workflow task content type.

    Those content type contains different metadata that users have to complete to go to the next step of the workflow. Data that are in those content type are really important for us because it contains business data. 

    I know that the workflow instance disappear 60 days after completion from the workflow menu. So I have created a unique ID for each item in the main list ( on which workflow is executed ) and I add this unique ID to different tasks created by workflow to allow me to link them and to retrieve related tasks.

    I have seen on internet that workflow auto clean up job can remove associated workflow tasks and for me this is impossible  because as explained tasks contains important business data. For the moment I have done a lot of workflow in this way and the tasks are not deleted even 2 years after completion.

    I would like to understand how this job works and if my tasks are safe.

    Thank you for your help.

    Alex

    Thursday, November 8, 2018 5:16 PM

Answers

  • Hi Alex,

    SharePoint 2010 workflows are different with SharePoint 2013 workflows.

    For SharePoint 2010 workflows, the job runs daily to permanently deletes workflow instances and related tasks that still exist 60 days (default value) after a workflow is completed or canceled. 

    For SharePoint 2013 workflows, as the workflow instances exist on the workflow manager database not on the SharePoint content database. Therefore, the timer job "Workflow Auto Cleanup" won't delete the workflow instances. The workflow instances deletion will be done by the Workflow Manager from the workflow manager database, and the workflow status link on SharePoint will be deleted by the timer job.

    More information, you can refer to the MSDN blog:

    https://blogs.msdn.microsoft.com/ahmedamin/2017/10/01/sharepoint-workflow-auto-cleanup/

    Thanks,

    Wendy


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Proposed as answer by Dennis GuoModerator Thursday, November 29, 2018 9:02 AM
    • Marked as answer by AlexDev62 Thursday, November 29, 2018 10:04 AM
    Wednesday, November 28, 2018 10:00 AM
    Moderator

All replies

  • I hope you can use th ebelow setting to increase the auto retention period

    https://blogs.msdn.microsoft.com/nishand/2007/09/11/changing-the-spworkflowassociation-autocleanupdays-property/


    Please remember to click Mark as Answer on the answer if it helps you

    Thursday, November 8, 2018 6:58 PM
  • This one as well

    https://blogs.msdn.microsoft.com/ahmedamin/2017/10/01/sharepoint-workflow-auto-cleanup/


    Please remember to click Mark as Answer on the answer if it helps you

    Thursday, November 8, 2018 6:59 PM
  • Hi,

    I have already seen those links, problem is that it doesn't answer to my question.

    I would like to know if my custom tasks will be deleted or not. I have workflows with custom tasks list and custom tasks content type inside.

    Nothing has been deleted in the custom tasks list but I would like to be sure that it will never be the case.

    So, I would like to know exactly what the Workflow auto clean up does.

    Thank you for your help.

    Alex

    Thursday, November 8, 2018 11:06 PM
  • Hi Alex,

    The job will not delete the tasks in your tasks list, and just the connection between the workflow and the workflow history is deleted after 60 days.

    So, your tasks will be not deleted by the timer job.

    There is a blog about this timer job for your reference:

    Sharepoint “Workflow Auto Cleanup” mystery

    Thanks,

    Wendy


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Friday, November 9, 2018 10:10 AM
    Moderator
  • Hi Wendy,

    We have somes case with 2010 workflows that use the default task list.

    For those standard approval workflows, tasks from the default tasks list has been removed. That's why I would like to be sure that task from 2013 workflows will remained available all time.

    Thanks for your help,

    Alex

    Friday, November 9, 2018 2:31 PM
  • Hi,

    Do you know why tasks from 2010 workflows has been removed ? Is this a different behavior with SharePoint 2013 ? 

    I just want to be sure that tasks from 2013 workflows are safe and understand why with 2010, tasks has been removed.

    Thank you,

    Alex

    Wednesday, November 28, 2018 8:50 AM
  • Hi Alex,

    SharePoint 2010 workflows are different with SharePoint 2013 workflows.

    For SharePoint 2010 workflows, the job runs daily to permanently deletes workflow instances and related tasks that still exist 60 days (default value) after a workflow is completed or canceled. 

    For SharePoint 2013 workflows, as the workflow instances exist on the workflow manager database not on the SharePoint content database. Therefore, the timer job "Workflow Auto Cleanup" won't delete the workflow instances. The workflow instances deletion will be done by the Workflow Manager from the workflow manager database, and the workflow status link on SharePoint will be deleted by the timer job.

    More information, you can refer to the MSDN blog:

    https://blogs.msdn.microsoft.com/ahmedamin/2017/10/01/sharepoint-workflow-auto-cleanup/

    Thanks,

    Wendy


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Proposed as answer by Dennis GuoModerator Thursday, November 29, 2018 9:02 AM
    • Marked as answer by AlexDev62 Thursday, November 29, 2018 10:04 AM
    Wednesday, November 28, 2018 10:00 AM
    Moderator
  • Hi Wendy,

    So if I understand well,

    With 2010 workflows, workflow auto cleanup job will delete:

    • Workflow instance and link
    • Workflow history 
    • Related tasks

    With 2013 workflows, workflow manager will delete:

    • Workflow instance

    Auto clean up job will delete:

    • Workflow instance link 
    • Workflow history

    And task from 2013 workflow will not be removed, Is that right ? 

    Thank you,

    Alex

    Thursday, November 29, 2018 9:18 AM
  • Hi Alex,

    Workflow history items in the hidden workflow history list are not deleted by the time job for SharePoint 2010 workflows and SharePoint 2013 workflows.

    Yes, tasks from SharePoint 2013 workflows will not be removed by the timer job.

    Thanks,

    Wendy


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, November 29, 2018 9:25 AM
    Moderator
  • Ok, Generally I create a custom workflow history list for workflows, I don't use the default one.

    This list is hidden too and associated to workflow.

    So same in this case, history will not be deleted ?

    Workflow auto cleanup job is dangerous, many companies use built-in approval workflows. That means that for this workflows, as they are 2010, tasks are removed and companies lost the history about "who has approved document" ?

    Thank you for your help.

    Alex

    Thursday, November 29, 2018 9:42 AM
  • Hi Alex,

    Yes, you are right.

    In addition, if the replies help you, please remember to mark them as answers, it will be beneficial to others in the community who meet this similar issue in the future.

    If you have other questions about this issue, please feel free to reply.

    Thanks,

    Wendy


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, November 29, 2018 9:50 AM
    Moderator