Error "System.NullReferenceException: Object reference not set to an instance of an object"

  • 26 March 2021
  • 0 replies
  • 206 views

Userlevel 5
Badge +19

ISSUE

When a task is assigned to a user using the UPN account property, the following error might occur:

Nintex.Workflow.NWActionExecutionException: Error in task. ---> System.NullReferenceException: Object reference not set to an instance of an object.
 
RESOLUTION

In environments where the UPN property is being used as the primary ID, it should be converted into a domainusername property in a workflow first before then using this to assign a task.

To convert from a UPN to a domain username in the workflow you can use a combination of two actions. The Regular Expression action (https://help.nintex.com/en-US/nintex2019/current/#sp2019/Workflow/ActionsCore/RegularExpression.htm) which will be used to extract out the username, and then the Build String action (https://help.nintex.com/en-US/nintex2019/current/#sp2019/Workflow/ActionsCore/BuildDynamicString.htm) which will be used to combine the extracted username with your domain name.

In the Regular Expression action you can use the following pattern to extract the username from before the '@' character and store it into a variable: .+?(?=@)

Once you have the username you can then use Build String to combine your domain name and the variable such as: 'domain\{username variable}'.

 

ADDITIONAL INFORMATION
The UPN property is primarily used in environments where user accounts cross multiple domains. This is problematic for the workflow engine, which will struggle to recognize the user account and assign tasks correctly.

 

User Name Formats in Microsoft Developer Network.

0 replies

Be the first to reply!

Reply