0

I need to display a warning message to the author before they publish. With the code below, I get the following exception:

Object Reference not set to the instance of an object exception. Sitecore.Context.ClientPage.ClientResponse is null.

How can I fix this? Or is there a different way to do this?

public class PublishPipeline : 
Sitecore.Publishing.Pipelines.PublishItem.PerformAction
{
    public override void Process(PublishItemContext context)
    {
        Sitecore.Context.ClientPage.ClientResponse.Alert("This will publish to the production site!");
        base.Process(context);
    }
}


<processor type="MyProject.PublishPipeline, MyAssembly" />
Kate Orlova
  • 3,225
  • 5
  • 11
  • 35
  • 2
    I think it's not the right approach. You should override Sitecore Publish Wizard Form. Refer: https://horizontalintegration.blog/2017/12/05/how-to-override-sitecore-publish-wizard-form/ https://stackoverflow.com/questions/26475500/how-to-customize-publish-action-sitecore – Nikki Punjabi Oct 22 '18 at 21:04
  • Thank you! This is exactly what I was looking for. – Anthony Fernandes Oct 25 '18 at 15:53
  • 1
    Going with Nikki Punjabi's solution provided above: https://stackoverflow.com/questions/26475500/how-to-customize-publish-action-sitecore – Anthony Fernandes Oct 25 '18 at 15:59

0 Answers0