Try our conversational search powered by Generative AI!

Different sets of [Required] properties depending on content status (Draft, Published) etc



I got a question from a customer today which got me thinking. The use case is that they want to quickly create pages, i.e have very few required properties.

They are fine with the pages being sort of empty while in Draft. But when they go ahead and Publish the content, there are more properties that must have values.

How would I go about this? There's the OnPublishing-event where one could check values on said properties, or one could extend the Required-attribute and make it take a Status-flag, or...

Pros/cons? stupid idea altogether?

Edited, Oct 10, 2017 14:57

Take a look at implementing a validator based on IContentSaveValidate interface.

Then you will get in a context that contains the SaveAction meaning you can have different validation based om which SaveAction it is (e.g Publish) 

Oct 10, 2017 19:57

Thanks!   Looks like a nice approach.

Oct 10, 2017 20:21

Hey Thomas

I blogged about that very same idea:


Oct 10, 2017 22:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.