Please help! We are down!
Has anyone ever seen this happen before?
I cant access my sales orders, this is the error message that pops up:
Error: The entry form (ID: SO301000, title: Sales Orders) cannot be automated. Object reference not set to an instance of an object.
Best answer by Naveen BogaView original
I had the same “Object reference not set to an instance of an object” error while trying to follow the steps described in T200 MaintenanceForms. The Step 1.6.1 requires a “FieldUpdated” event handler to be created but I created another event. After deleting the unnecessary event handler code from the graph, I added the correct one. Then save and Publish.
@jknauf and @Naveen B !
I found the customization and unpublished it!
To add to what Naveen has said, within the actual customization itself this is a fairly common issue. It’s called a null reference exception. Pretty much what that means is that you’re trying to use some data, but you’re not telling the code what data to use.
For example you may have code trying to find your desired sales order. Well maybe under certain circumstances it doesn’t find any sales order that meet your conditions. A common example of when this may happen is when the page is loading. when SO303000 loads, it often fires off Event Handlers before it gets a reference to a sales order. When this happens, if your Event handlers try to get the current sales order, that variable will contain the value null, meaning nothing was found. Then when you try to use that variable, you get this null reference exception.
Anyway, TL;DR, This is a common issue and easily fixed. One of your variables in the code is null when you try to use it. You can fix this by ending your code if a variable is null before you use it, or use null safe accessors. Here are examples of both respectively:
In this example, we declare row as a SOOrder variable, but if it fails to find an actual SOOrder, we call return, which ends the code block.
In this example, we use c#’s null safe accessor, ‘?.’. using the ‘?’ before a standard access makes the access null safe, meaning it won’t throw an exception/break when row is null. Instead, if row is null in this case, orderNum will also be null! It’s a very useful trick.
Anyway, hope this helps!
@stacy16 This issue is causing by Customizations that were built on the Sales Order screen.
To confirm this you can unpublish the customization and verify.
for immediate help, you can raise a support case with Acumatica to know which customization is causing this issue.