Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 965
  • Last Modified:

Automatically delete completed documents from workflow after 3 months

Hi,

I have built a custom workflow for WSS 3.0 using Sharepoint Designer 2007 which works great.  I was wondering if it is possible to automatically delete completed documents after a certain time period, e.g. 3 months?  I know I can set a view to hide them but is there any way to remove them?

Many Thanks,

John
0
john-formby
Asked:
john-formby
1 Solution
 
Jamie McAllister MVPArchitectCommented:
The simplest approach is to build your Workflow with a delay activity of 3 months duration. After the delay completes you have an activity in your workflow that deletes the file.

Beware of the issues with Delay activities as detailed here;

http://blogs.msdn.com/sharepoint/archive/2008/01/04/issues-with-the-delay-activity-in-sharepoint-workflows-we-need-your-help.aspx
0
 
StevenMulkerrinsCommented:
An alternate method is to use an Information Management Policy. This will allow you to create a retention policy deleting the document after a certain period of time. To do this, go to your document library, go to the settings menu and choose document library settings. On the settings screen, go to 'Information management policy settings'. Choose to define a policy and click ok. In your case you can set the retention period to be based on the items properties, for e.g. Created + 3 months (you can also set the period in your workflow if needed). You then set what to happen when the period expires, you can either just delete the document, or if you prefer you can run another workflow.

That's a basic example. You can also create a policy at the site collection level and then apply that  to multiple libraries. Also, if you use content types you can have a policy which applies to specific content types as well.

More reading: http://blogs.msdn.com/recman/archive/2006/06/29/651347.aspx
0
 
Leo_SkybirdCommented:
I would use Information Management Policy. The reason is it is much easier to use, especially if you are not familiar with work-flow.
Personal opinion, just for your reference!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
john-formbyAuthor Commented:
Hi,

Thanks for the replies.  I tried to find the Information Policy Management Settings in Document Library Settings but I can't see it.  I am using WSS 3.0.  Is this something specific to MOSS?

Many Thanks,

John
0
 
Jamie McAllister MVPArchitectCommented:
Yes it's specific to MOSS;

http://msdn.microsoft.com/en-us/library/ms499244.aspx

How are you getting on with the Delay Activities?
0
 
john-formbyAuthor Commented:
Hi Jamie,

I want to use the Delay Activities but am not sure how to add this to my workflow?  Can you provide details of how I achieve this?

Many Thanks,

John
0
 
Jamie McAllister MVPArchitectCommented:
In SPD Workflows you add them as one of your steps - so you'd set your condition, then for your Action click Action -> More Actions, then you could either choose "Pause for Duration" or "Pause until Date".

Apologies if my terminology confused you, they're called "Delay Activities" in Visual Studio Workflows, which is how I do my Workflows.

Just for info my environment is .NET 3.5 and SPD has Service Pack 1 installed.
0
 
john-formbyAuthor Commented:
Hi Jamie,

I have set up a new step that says if my workflow is complete (I have a status field) then pause for X days.  What happens after this time?  Does it get automatically deleted or is there something else I need to do to make it delete?

Many Thanks,

John
0
 
Jamie McAllister MVPArchitectCommented:
The pause is just a pause. Any action in your workflow that needs to occur after that time needs to be put in the WF explicitly by you.

I don't have my SPD to hand as I type, presume there's a delete action of some kind. I'll check when I get to a PC.
0
 
Jamie McAllister MVPArchitectCommented:
Confirmed, as you've no doubt already seen there is an Action in SPD called 'Delete Item'.
0
 
john-formbyAuthor Commented:
Hi Jamie,

Yes, I have seen this but I can't get it to work.  At the end of my workflow (if all people approve the document), the Status field is updated to "Complete"  I have added a step after this which has the following:

Condition
If Status equals Complete

Action
Pause for 0 days, 0 hours, 1 minutes
then Delete Item in Workflow1
then Stop the workflow and log Deleted

Do you know why this would not work?

Many Thanks,

John
0
 
Jamie McAllister MVPArchitectCommented:
I seem to remember that there was an issue with Delay activities and you need .NET 3.5 SP1 for them to work properly. Do you have Service Pack 1 for .NET 3.5 installed?

The post with an explanation of that and a link to the Infrastructure Update is here; http://blogs.msdn.com/sharepoint/archive/2008/01/04/issues-with-the-delay-activity-in-sharepoint-workflows-we-need-your-help.aspx

Aside from that, delay activities are not precise, they depends on a Timer Job that polls for Delay activities whose time is due and rehydrate the workflow.  

So, three thoughts occur if the above isn't the issue, either the delay might be too short, some process might not have permission to delete (seems unlikely), or the Delay Activity Timer job might not be rehydrating the WF successfully.

This post should help you investigate those; http://www.clearbridgeltd.com/journal/2009/3/8/windows-workflow-delay-activity-and-moss.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now