Dear,
Is there any possible way to change the workflow auto cleanup days from 60 days to 365 days for SharePoint Server 2019. Facing may issues due to the auto cleanup. Kindly help.
Regards,
Dear,
Is there any possible way to change the workflow auto cleanup days from 60 days to 365 days for SharePoint Server 2019. Facing may issues due to the auto cleanup. Kindly help.
Regards,
Hi, @RaeesK-7989 ,
Have you tried the script? Does it work for you?
Feel free to reply with any update about it.
Hi, @RaeesK-7989 ,
You can use PowerShell to change the AutoCleanUpDays property of workflow from default 60 days to 365. It is a workflow level property so you can change only the required workflows. And workflows are associated to list, you need to know the list name.
Here are scripts work in my end:
For changing a specific workflow:
$site=get-spweb -site "<siteURL>"
$list=$site.lists["<ListName>"]
$wfs=$list.WorkflowAssociations
$wf=$wfs.GetAssociationByName("<WorkflowName>","en-US")
$wf.autocleanupdays=365
$wfs.update($wf)
And if you want to change all the workflow in a list.
$site=get-spweb -site "<SiteURL>"
$list=$site.lists["<ListName>"]
$wfs=$list.WorkflowAssociations
for ($i = 0; $i -lt $wfs.Count; $i++)
{
$wf=$wfs[$i]
$wf.autocleanupdays=365
$wfs.update($wf)
}
Let me know if it works well or not.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
5 people are following this question.