Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a quick way to delete large Workflow Process history stack?

Tags:

tridion

Is there any quick way/trick to delete around 85K entries for the workflow process history? Trying from the GUI gives a storage issue and to resolve this issue need to bounce the box.

Also trying the PowerTool crashes after a long time. Thought to ask the wider community. appreciate for your thoughts.

Thanks Vin

like image 307
Vinod Bhagat Avatar asked Feb 20 '12 19:02

Vinod Bhagat


2 Answers

Which version of Tridion? 2011?

You could probably get away with a CoreService client app that does this regularly for you. By "PowerTool" I assume you mean the Purge tool?

Also - I would likely contact Customer Support about the errors you see, doesn't seem like using the GUI or the Purge Tool should fail.

If you're on 2011 SP1 you could use the following code:

using System;
using System.ServiceModel;
using System.Xml;
using Tridion.ContentManager.CoreService.Client;

namespace DeleteWorkflowHistory
{
    class Program
    {
        private const string NetTcpEndpoint = 
            "net.tcp://localhost:2660/CoreService/2011/netTcp";
        private static readonly EndpointAddress EndpointAddress =
            new EndpointAddress(NetTcpEndpoint);

        static void Main(string[] args)
        {
            var binding = new NetTcpBinding 
            { 
                MaxReceivedMessageSize = 2147483647 
            };

            var quota = new XmlDictionaryReaderQuotas
            {
                MaxStringContentLength = 2147483647,
                MaxArrayLength = 2147483647
            };
            binding.ReaderQuotas = quota;
            var client = new SessionAwareCoreServiceClient(binding, EndpointAddress);
            Log("Connected to Tridion Content Manager version: " + client.GetApiVersion());
            ProcessesFilterData filter = new ProcessesFilterData
            {
                BaseColumns = ListBaseColumns.IdAndTitle,
                ProcessType = ProcessType.Historical
            };
            foreach (IdentifiableObjectData data in client.GetSystemWideList(filter))
            {
                var processHistory = data as ProcessHistoryData;
                if (processHistory != null)
                {
                    Log("Deleting history: " + processHistory.Id + " / " + processHistory.Title);
                    client.Delete(processHistory.Id);
                }
            }
            client.Close();
        }

        private static void Log(string message)
        {
            Console.WriteLine(string.Format("[{0}] {1}", DateTime.Now.ToString("HH:mm:ss.fff"), message));
        }
    }
}

N

like image 55
Nuno Linhares Avatar answered Nov 15 '22 04:11

Nuno Linhares


If you can't use the Core Service, have a look at this blog entry, which describes using the Powershell to force workflow processes to complete. With some very minor modifications, the same technique would work for deleting workflow processes.

like image 1
Dominic Cronin Avatar answered Nov 15 '22 06:11

Dominic Cronin