I hava a problem on handling publish event in event system.

What I want to do is following.

When a user publish page or component, get following information and output them to a log file.

  • published item name
  • the user name who published
  • publish transaction ID which is generated by the published item

The problem is getting publish transaction ID.

It's possible to get transaction ID by "PublishEventArgs.PublishTransactions". But, for instance a user selects 3 pages and publishes them at one action, "PublishEventArgs.PublishTransactions" returns 3 transactions in each page publishing event. So I cannot distinguish which one is generated by a published page.

Is this normal behaviour of event system?

How can I get correct publish transaction in page publishing event?

  • You mention "The problem is getting publication transaction ID", can you confirm/edit your question that you actually mean Publish Transaction ID, not Publication? Nov 13, 2014 at 15:00

4 Answers 4


Here is a bit of code to get you started:

    private void PagePublishEventHandler(Page page, PublishEventArgs args, EventPhases phase)
        //NOTE: 1:many relationship. You should add some logic here instead of only looking at the first one.
        var pubTransaction = args.PublishTransactions.First(); 
        string transactioId = pubTransaction.Id.ToString();

Note: in Tridion, each Page object is associated to one or more transactions. It's a one to many relationship because you can publish a Page to more than one Publication Targets, hence having more than one transaction for one given page. You could add to your logic to write a logging statement for each transaction for a given page.


Event system in tridion is based on subject action combination. So, when you select three different pages and publish them together though the end interaction is single it resolves to three different subject action combination, one for each page. Sometimes it might be more if you select publish from child publication, which would then result to three pages times the number of child publication those pages can be published by that user. However, for your case you probably want all three different ones, as the three different page publish will actually result in complete three different publish transactiona altogether. So, it might be a good idea to record all three of them.


A possible solution would be to use an event trigger on the PublishTransaction object instead of the Page object - depends on what exactly you're doing with your event.

If you do this, then the subject is a PublishTransaction, and you can access the ID by using subject.Id.


One Publish transaction will only contain items(page, component, keyword) from 1 publication. Tridion will create multiple publish transaction when items from multiple publication are selected in 1 publish action (i.e. publish in child publications)

    public static void TriggerEvent(Page page, PublishEventArgs args, EventPhases phase)
        var pubId = page.Id.PublicationId;
  • @Hirokazu is searching for the publish transaction ID, not the publication ID
    – Nuno Linhares
    Nov 13, 2014 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.