Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Handling RequiredPropertyValueException

Vote:
 

The following error occured while we are publishing/saving a page.

EPiServer.Core.RequiredPropertyValueException: "Main body" cannot be empty

Details as follows:

We have a property named "Main body" set as mandatory and not displayed in edit mode (Please note that we want this condition to be in place as it is a requirement).

When we are publishing the page Epi server is not validating the property but throwing an exception which we are unable to catch in code.

 

 

#42098
Aug 09, 2010 9:00
Vote:
 

If you set it in code, why do you need the mandatory flag set?

Does setting the mandatory flag to false fix the problem?

#42106
Aug 09, 2010 10:53
Vote:
 

Even I have faced a similar issue, it just does not come into the code. Setting the mandatory flag to false does fix the problem but the requirement is to have it mandatory.

This happens when i create a page with the property not set to mandatory (and dont enter any content in it) and later on if we modify the property as mandatory, you get this error since the page is already created. These errors are generally done by admin users who are not aware of these kind of implications, well i want to build my code in such a way that the errors made by illiterate users are caught and handled ie, make my code more robust. Is there any way to catch these types of exceptions as it takes the whole site down rather than just the created page.

#42151
Aug 10, 2010 15:31
* 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.