5

I have a scenario where i need to know who has initiated a publish for a component/page. Once that user is known, I need to put that user's name into my component and then it has to go for publishing. What would be the best way to do that?

I came across PublishEngine.GetPublishInfo method, which would be helpful in giving me the required values. Can anyone explain me whether this PublishEngine would be active/available in event system? or usually when would it be available? Can we use it in templates as well?

Addition: We need this because, once the component/page is published, our application would be consuming this component/page and would like to know the user who has published so that we can send the information on mail to him that publishing is successful but something went wrong in application so no need to publish again if he doesn't see his changes.

  • The catch with this approach is users would be able to update that field. How will you use this user information? If for display on the site, consider adding it via templating. Otherwise if it's for audits or tracking, AppData may be a good candidate to store this independent of the component fields. – Alvin Reyes Jun 4 '13 at 11:23
  • Exactly..users should not edit. Thanks Alvin and i will explore more about app data. – Sri Jun 4 '13 at 12:09
  • As long as the event system always overwrites that field on a publish event, then editors can edit it all they want without any impact. – Nickoli Roussakov Jun 4 '13 at 12:34
  • Do you want to store this information in a separate, dedicated component or in the component being published? How will this work if a single component is published with multiple DCTs or when a page is published? If you are primarily interested in keeping an audit trail I would recommend to use the Event System and write a message into the event log every time a user creates a publish transation... – Bjørn van Dommelen Jun 4 '13 at 14:50
4

To answer your queries, following are my comments:

  1. YES, PublishEngine and PublishEngine.GetPublishInfo will be available to use in the Event System and you can use it to retrieve the information you are looking for.
  2. YES, you can use the PublishEngine and PublishEngine.GetPublishInfo in the Templates as well.

Now my question would be, why do you want to put it in the Component before the publishing? Instead, you may incorporate a logic in your Template to put this information in the Component Presentation

Kindly provide more details so that more accurate answer can be provided.

| improve this answer | |
  • Added more details – Sri Jun 4 '13 at 12:28
  • I really want to understand why you want to Insert this user information in the component itself. Why can't at the run time you retrieve this information from CMS if the presentation renders to fail. Secondly, why should this presentation will get failed to show up, if we validate it during the publishing process depending the rendered component presentation, why shouldn't we send the message to the User and fail the publishing. Can you please further elaborate your business requirement? – Pankaj Gaur Jun 4 '13 at 13:06
  • We are sending the presentation (UI) code in the form of component and when something wrong goes on my presentation ap side my user should know that it was not publishing that has failed but instead something happened in presentation app and infra team has to look at it rather than publishing it again and loosing confidence on tridion publishing. So, instead of failing publishing, and asking him to republish for the mistake of presentation app, we thought of sending the user info itself every time in presentation comp itself. We could send the mail from app side then and no need of republish. – Sri Jun 5 '13 at 5:53
  • Can you please explain using proper Tridion Terms? You can not send a Component anywhere, it is specific to the Tridion only. you only send a rendered presentation in the form of some file on the File System (Presentation App Side). What is the extension of this file that you are sending the information of the component in the form of rendered presentation. Also, how this file will be intact if "something happened" at the presentation app side? – Pankaj Gaur Jun 5 '13 at 7:21

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.