Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Error when saving item with item relation list

Error when saving item with item relation list

Lars Larsen
Lars Larsen
Reply

Hi

I have an itemtype attached to an area in DW9.1. The itemtype have some item relation list fields. When I edit the area and changes some of the fields on the area and saves the area I get this error message attached below. What can be wrong?

Besides that I can't have a TemplateTags() statement in a page template without getting the error message below which I think has something to do with the item relation list fields on the area.

Server Error in '/' Application.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 
 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 
 

[NullReferenceException: Object reference not set to an instance of an object.]
   Dynamicweb.Content.Items.Editors.ItemRelationListEditor.RenderValue(EditorRenderingContext context) +593
   Dynamicweb.Content.Items.Rendering.Renderer.RenderItemField(ItemField field, Object value, Dictionary`2 validationErrors, Boolean allowEditing, Template template, String tagPrefix, ItemEntry itemEntry) +838
   Dynamicweb.Content.Items.Rendering.Renderer.RenderItem(ItemEntry item, ItemSettings settings) +4443
   Dynamicweb.Frontend.Renderer.RenderPage(Template template, PageViewModel pageViewModel) +2064
   Dynamicweb.Frontend.PageView.SetPageTemplateValues() +783
   Dynamicweb.Frontend.PageView.Output() +611
   Dynamicweb.Frontend.DynamicwebHttpHandler.ProcessRequest(HttpContext context) +197
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +507
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1073.0

Capture.PNG

Replies

 
Nicolai Pedersen
Reply

Hi Lars

That stack seems to come from showing a page in the frontend - and not from saving an area... Where did you get the stack trace from?

BR Nicolai

 
Lars Larsen
Lars Larsen
Reply

Hi Nicolai

Your'e right the stack is from the frontend when I try to render a page with a TemplateTags() statement in the page template. When saving the area I get the Javascript errormessage dialog.

 
Nicolai Pedersen
Reply

So, how is that related to saving an area? Not sure I understand the link...

 
Oleg Rodionov
Reply

Hi all,

I've tested environment based on 91 admin and have good results when use related list (inline/page/paragraph types) in page/paragraph/page properties/area, no any error occurs on saving the content and frontend rendering, please find the proof -  http://www.screencast.com/t/fH6kZ6i2SS

Lars, please, specify scenario if it doesn't fully correspond to mine.

BR, Oleg QA

 

 

 
Lars Larsen
Lars Larsen
Reply

Hi Oleg

Thanks for your nice demo. As you show in your video you doesn't have the problem. So I will look deeper into it on my solution and test further to see if I can narrow down the problem.

 
Lars Larsen
Lars Larsen
Reply

Hi Oleg

The problem was related to a requiered field on the same itemtype that has the item relation list field. I had checked the "Required" checkbox for a heading field on the itemtype and then entered a custom errormessage. But the errormessage was held in the field "Validation expression"! I removed the errormessage from the "Validation expression" field and then I was able to save without getting the Javascript errormessage ("Number of relations is not allowed....."). After this I tried to set the heading field on the itemtype to required and entered a custom errormessage. But the custom errormessage is not saved!

 
Oleg Rodionov
Reply

Hi Lars,

I've tried to check your scenario as far as I understood,  text fields now have enabled 'Required' options and should be fit to email format. I was not able to catch any issue, all performs properly. Please, find the proof attached (Screencast is failed today).

BR, Oleg 

 
Lars Larsen
Lars Larsen
Reply

Hi Oleg

Have you tried having an  itemtype field like this:

  • the field is required
  • no validation expression
  • a custom errormessage

When I have a field like that the custom errormessage is not saved when I save the itemtype.

 

You must be logged in to post in the forum