Empty Publish Transactions Event Handler

When you are working with SDL Tridion (2011 or 2013), you must recognise the following situation; You select something for Publish, choose a target and press the Publish button. You check the Publish Queue afterwards and see the Publish Transaction you just created has the state Success already. You are pleasantly surprized by the speed, but when you check your Content Delivery environment, you notice that nothing was really published. A double check on your Publish Transaction, shows you that it contained no items, and thus according to the rules, nothing went wrong, so the state is Success...

The reasons for a Publish Transaction turning up empty (containing zero items) can be multiple, it could be something as simple as a republish action of a structure group, but none of the items inside had been published before to this target, so none of them are republished. But all in all it is regarded widely as a nuisance that the state of an empty Publish Transaction shows up as Successful, where a state of Warning might seem more appropriate.

This eXtension contains an event handler which is triggered when an empty Publish Transaction is set to Success, changing the state to Warning, indicating that nothing had been done. When you look at the actual code, you see that it almost is a one liner. Simple but very effective in indicating that nothing had been done.

It requires no further configuration, unless you want to make some changes to the code. It is released as open source, so you are free to use as is, or modify to your own likings. The extension download contains a DLL compiled for SDL Tridion 2013 SP1, but the source code will work fine on any 2011 or 2013 version, provided you compile it aginst the correct DLLs.

Installation

This eXtension comes with full source as a Microsoft Visual Studio solution which you can directly compile and deploy (you can use the free Microsoft Visual Studio Express edition). To install the event handler you need to place the assembly on the SDL Tridion Content Manager server and register it as described in the following steps.

  1. Start with shutting down the following services on your Content Manager server:
    1. IIS
    2. The SDL Tridion COM+ application
    3. The Tridion Content Manager Service Host service
    4. The Tridion Content Manager Publisher service 
  2. Compile the solution to a .NET assembly and store on your Content Manager server (or you can use the already compiled assembly on a 2013 SP1 system)
  3. Open the configuration file called Tridion.ContentManager.config, located in the config/ subfolder of the Content Manager root location (typically C:\Program Files\Tridion\), in a plain-text or XML editor. Find the extensions element in this file. If the element is empty (that is, if it reads <extensions/>), replace it with <extensions></extensions>. Then add a line of the following format:

    <add assemblyFileName="C:\path\to\EmptyPublishTransactionsEventHandler.dll" />

    If the element was empty, the fragment should now read:

    <extensions>
        <add assemblyFileName="C:\path\to\EmptyPublishTransactionsEventHandler.dll" />
    </extensions>
  4. Save and close Tridion.ContentManager.config
  5. Restart the services you stopped

You can now use your Content Manager as you normally do. When an empty Publish Transaction is executed and it state is changed to Success, the Event Handler will kick in and change the state to Warning and set a message inside the Publish Transaction.


Developer
:    Bart Koopman
Company
License agreement
Tags
:    Event System,  2013,  2011,  Publish ,  Transaction
Version
:   1.0
Source
:   Yes

About the Author
Bart Koopman
Community Development Consultant

As a Community Development Consultant, Bart is the evangelist of all SDL Tridion products. Bart used to be a consultant and trainer at SDL Tridion, supporting both partners and customers with their implementations.

SDL CMT division