Key Points of SharePoint cleanup of workflow history information

Source: Internet
Author: User

Disable Automatic job clearing for workflow history

======================================

Workflow is composed of several column events, such as workflow initiation, task creation, and task completion. when you add a workflow, a workflow history database is automatically created to track workflow events. the workflow history database stores key information about each event, including date, status, participant, and description. the workflow history record items are stored in the Sharepoint list. This list is associated with the list or document library to view the status and report errors of workflow.

 

Microsoft Office Sharepoint Server 2007 runs a workflow auto cleanup job every day, It removes completed or canceled 60-day records from the workflow history list. [Translator's note]: this passage is incorrect. the actual situation is that the record items in the workflow list are not deleted. The only thing to delete is the association between the document and the list items in the workflow history list, the purpose is to clear the workflow instance and task list. if you want to track the Workflow Information for a longer period of time, you can disable this workflow auto cleanup job.

 

However, like any Sharepoint list, if your workflow history list contains more than 2000 Projects, the performance of your site will be affected. if you are concerned about the size of the workflow history list, you can re-enable the workflow auto cleanup job. you can create a separate workflow history list for each workflow Association.

For more information, see Add a workflow to a list or document library.

Note: The purpose of workflow history is not to monitor workflow events, and it is not safe enough. office Sharepoint Server 2007 maintains a log about workflow events, but does not provide a predefined monitoring report. you can use the spauditentry class to write a custom monitoring log (audit log)

 

To disable automatic workflow clearing

  1. From Central Administration, clickOperationsTab on the top navigation bar.

  2. On the operations page, in the global configuration section, clickTimer job definitions.

  3. On the timer job definitions page, clickWorkflow auto cleanupTo edit the appropriate timer job.

  4. On the Edit timer job page, clickDisableAnd then clickOKTo disable the workflow auto cleanup feature.

How can I modify the 60-day period for automatic clearing?

======================================

Spworkflowassociation by default. the value of autocleanupdays is 60 days. To modify this value, you need to call splist. updateworkflowassociation (spworkflowassociation) function, in this spweb. the Update () method does not work.

   1: SPSite site = new SPSite("

   2: SPWeb web = site.OpenWeb();   

   3: SPWorkflowTemplateCollection collection = web.WorkflowTemplates;   

   4: SPList list = web.Lists["Shared Documents"];   

   5: SPWorkflowAssociation _asso = null;   

   6: foreach (SPWorkflowAssociation asso in list.WorkflowAssociations)  

   7: {  

   8:     if (asso.Name == "Approval")   

   9:     {  

  10:         asso.AutoCleanupDays = 100; 

  11:         _asso = asso;  

  12:     } 

  13: }  

  14: List.UpdateWorkflowAssociation(_asso); 

 

The above code is modified at the site level. The following code is modified at the web application level through stsadm.exe.

Stsadm-O setproperty-propertyname job-workflow-autoclean-propertyvalue "yearly at Jan 1 15:00:00"-URL

For more information, see

Http://technet.microsoft.com/en-us/library/cc424956.aspx

 

An alternative to viewing the lost workflow history information

======================================

As mentioned above, in the workflow history list, you cannot see the workflow completed 60 days ago by default. the information about workflow is still in the task list and workflow history list, but the association between workflow and list items has been removed from the database.

 

Even if the workflow auto cleanup job overflows the association between workflow and a document, the history of workflow is still stored in a separate list. this is a hidden list called "workflow history ". all workflows related to a given document are visible, but the storage format is not easy to read.

 

The best solution to link a document with its historical Workflow Information is to retrieve information from the hidden list and match it with the document attributes.

 

Detailed steps are included in the workaround for missing workflow HISTORY Article.

The statement is as follows:

All information is in, but the association is not. therefore, by creating a new view on the workflow history list, adding grouping and filtering to the columns, you can view the historical information of the workflow in a specific document.

  1. First, create a new view in workflow history, including the user ID, event type, date occurred, outcome, and description attribute columns.
  2. Sort by creation date attribute column.
  3. Obtain the list ID of the document library you want to view, and use this ID as a filter of the workflow history list, so that this view only displays the records of the document in the list you want to see.
  4. Then, the displayed items are grouped by the primary item ID. In this way, according to the different associated documents, workflow is classified under the associated documents.
  5. Then, the group is performed again according to the workflow history parent instance, so that different workflows enabled for the same document are also grouped together.

This should be the case.

 

The next step is to add an attribute for the document in the document library. Click this attribute and navigate to the section of the document in the newly created view in the workflow history list. in this way, the corresponding relationship is completed, and our ultimate goal is to view the Workflow Information 60 days ago.

 

The most important part of adding a column for this attribute is to add a formula for this attribute.

The formula is as follows:

= Concatenate ("http: // sharepointserver/docs/lists/workflow % 20 history/auditview. aspx? View = % 7b450d5f02-a5d0-4e8e-ac13-4388c179d8ed % 7D & filterfield1 = item & filtervalue1 = ", right (docid, Len (docid)-search ("-", docid, 1 )))

Note that the view ID can be copied from the IE address bar at the top of the view page after creation.

 

For information about the functions in this formula, see:

Formulas and functions

Http://office.microsoft.com/en-us/sharepointtechnology/CH011711541033.aspx

 

Update:

After testing, the formula listed above has some problems. The following formula is successfully tested under SharePoint 2007 and SharePoint 2010.

= Concatenate ("http: // sharepointserver/docs/lists/workflow % 20 history/auditview. aspx? View = % 7b450d5f02-a5d0-4e8e-ac13-4388c179d8ed % 7D & filterfield1 = item & filtervalue1 = ", ID)

 

Original article address:

Disable Automatic cleanup of workflow history (this article has an error. The content of an article is listed later in the original article to correct it .)

Http://technet.microsoft.com/en-us/library/cc298800.aspx

Workflow scalability and performance in Windows SharePoint Services 3.0

Http://msdn.microsoft.com/en-us/library/dd441390.aspx

Changing the spworkflowassociation. autocleanupdays Property

Http://blogs.msdn.com/nishand/archive/2007/09/10/changing-the-spworkflowassociation-autocleanupdays-property.aspx

Workaround for missing workflow history

Http://www.sharepointblogs.com/drewdevo/archive/2008/08/27/workaround-for-missing-workflow-history.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.