-1

How can we make an event to trigger when component published from a specific Publication?

6

The event handlers (triggers) are system-wise, so you will have to control the publication scope from within the event itself. I would check it at the very beginning, see the example below:

[TcmExtension("YourEventSystem")]
public class YourEvent: TcmExtension
    {

        public YourEvent()
        {            
            Subscribe();
        }

        public void Subscribe()
        {
            EventSystem.Subscribe<RepositoryLocalObject, CheckInEventArgs>(HandlerForInitiated, EventPhases.Initiated);
        }


        private void HandlerForInitiated(RepositoryLocalObject subject, CheckInEventArgs args, EventPhases phase)
        {
            //Check for publication id match here
            if (subject.OwningRepository.Id != "your_publication_uri")
            {
                return;
            }
            //Your logic here...
        }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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