Help get this topic noticed by sharing it on Twitter, Facebook, or email.

REST Interface returns error Object not set to an instance ...

We are seeing this issue with a new controller and REST interface. The rest POST
is used to activate a Custom Business Rule on the controller, the business rule fires normally from the COT UI

We are using a secondary view to execute the Business Rule,

The line of code that is failing is in controller.cs line 1375 in method EnsurePageFields

var fieldName = fieldIterator.Current.GetAttribute("name", string.Empty);
if ((expressions.ContainsKey(fieldName)))
page.Fields.Add(new DataField(fieldIterator.Current, Resolver);

In our case the method is called with expressions specifically set to null from line 140

public ViewPage CreateViewPage()
if (_viewPage == null)
_viewPage = new ViewPage();
EnsurePageFields(_viewPage, null);
return _viewPage;

So to resolve it we added a check on expressions being null and it works as expected

var fieldName = fieldIterator.Current.GetAttribute("name", string.Empty);
if ((expressions!= null) && (expressions.ContainsKey(fieldName)))
page.Fields.Add(new DataField(fieldIterator.Current, Resolver));

I thiink maybe you might want to add something similiar.

Some more investigation and we found that we had not configured the view correctly, it uses a Base View (grid1) but we had not specified that in the controller setup, it works without one it seems but not if using the REST interface.


1 person has
this problem