Solved

Error "Object reference not set to an instance of an object" on PO Import

  • 31 May 2022
  • 7 replies
  • 2630 views

Userlevel 5
Badge

I am having this error on Import for POs, trying my best but still error is there. I have a few “=iif([PO Line Status]='Canceled', TRUE, NULL)” that may be causing this issue, but according to me those are correct.

Let me know if somebody have had this issue before, or maybe I need to open ticket.

Thank you community.

icon

Best answer by bryanb39 31 May 2022, 22:48

View original

7 replies

Userlevel 6
Badge +5

Maybe just a typo, Cancelled has 2 Ls.  Or does your data source have the same typo?  

Userlevel 5
Badge

Maybe just a typo, Cancelled has 2 lls.  Or does your data source have the same typo?  

Same typo on the file. Thanks for your answer! 

Userlevel 6
Badge +5

Try 1 and 0 vs True and Null, that should take care of that error.  

Userlevel 5
Badge

Try 1 and 0 vs True and Null, that should take care of that error.  

Change the IIF statements to “=iif([PO Line Status]='Received',1,0)” but new error shows up “

An error occurred during processing of the field Cancelled: Specified cast is not valid..”.

Userlevel 6
Badge +5

Oops, it just replaced it with a cast error.  It’s True and False, vs True and Null.  I got it to import. 

I had an error with unit cost, but just skipped it for now.  (That error was just with the item I used to test, hopefully you won’t have it)  

Userlevel 5
Badge

Oops, it just replaced it with a cast error.  It’s True and False, vs True and Null.  I got it to import. 

I had an error with unit cost, but just skipped it for now.  (That error was just with the item I used to test, hopefully you won’t have it)  

This was the issue… I dont know why my brain went for NULL instead of FALSE! Thank you @bryanb39 !

An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist or was deleted or cleaned up. It's usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested for null before being used.

if (mClass != null)
{
  // Go ahead and use mClass
  mClass.property = ...
}
else
{
  // Attempting to use mClass here will result in NullReferenceException
}

A NullReferenceException typically reflects developer error and is thrown in the following scenarios:

  • Forgotten to instantiate a reference type.
  • Forgotten to dimension an array before initializing it.
  • Is thrown by a method that is passed null.
  • Get a null return value from a method, then call a method on the returned type.
  • Using an expression to retrieve a value and, although checking whether the value is null.
  • Enumerating the elements of an array that contains reference types, and attempt to process one of the elements.

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved