SYNTAX HIGHLIGHTER BEGINS

Tuesday, September 15, 2015

Nintex Task Form NullReferenceException

Brief history, a client of mine had workflows created in Nintex on Sharepoint 2010 that did not use Nintex forms. These workflows were ported to  SharePoint 2013 with Nintex Forms.  After that none of the a “Request review”, “Request data” or a “Request approval” activity would work.
The simplest way to recreated the error was to preview the form but you would get the same error if you published and ran the workflow.


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.]

Nintex.Forms.SharePoint.ApplicationPages.PreviewNintexForm.GetDefaultValuesForWorkflowVariables() +557
Nintex.Forms.SharePoint.ApplicationPages.PreviewNintexForm.InitializeData() +846
Nintex.Forms.SharePoint.ApplicationPages.PreviewNintexForm.OnInit(EventArgs e) +645
System.Web.UI.Control.InitRecursive(Control namingContainer) +186
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2098

After "debugging" the Nintex's code I determined that it was using a XML file stored in a hidden SharePoint list. This XML file contained the form as well as the workflow variable definitions. 

It turns out that earlier versions of Nintex stored blank variables as . The new version stores them as the code did not support the old format.

All I had to do was go through all the workflow variables and assign them a single space as the default value and the forms started working again.