Try our conversational search powered by Generative AI!

Setting the PageStopPublish value based upon the value of another Property

Vote:
 

I have a case where I need to set the PageStopPublish of a page, based on the value of another property, but PageStopPublish doesn't seem to get set. 

I noticed that it is possible to set the stop publish in the SetDefaultValues property, but this is too early in the flow, so what I've tried is this.

public virtual DateTime? DueDate
        {
            get { return this.GetPropertyValue(x=>x.DueDate); }
            set
            {
                if (value != null)
                {
                    this.Property["PageStopPublish"].Value = value;
                    this.StopPublish = value;
                }
                this.SetPropertyValue(x => x.DueDate, value);
            }

but the stop publish doesn't seem to get set in the UI.

I've also tried adding the DueDate property as a fullrefresh property but even then the StopPublish isn't set.

Is it possible to solve this without a global event handler ?

#147542
Apr 18, 2016 12:55
Vote:
 

Have you tried using PageData.StopPublish property instead of PageData.Property["PageStopPublish"]?

Edit: Oh, on the next line, I see :) Property indexing is not necessary when using it.

#147614
Edited, Apr 20, 2016 0:12
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.