
Hi, @Raees K ,
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.