Skip to main content
Answer

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

  • May 31, 2022
  • 7 replies
  • 5070 views

martingaxiola
Varsity I
Forum|alt.badge.img

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.

Best answer by bryanb39

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)  

7 replies

bryanb39
Pro II
Forum|alt.badge.img+6
  • Pro II
  • May 31, 2022

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


martingaxiola
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • May 31, 2022

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! 


bryanb39
Pro II
Forum|alt.badge.img+6
  • Pro II
  • May 31, 2022

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


martingaxiola
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • May 31, 2022

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


bryanb39
Pro II
Forum|alt.badge.img+6
  • Pro II
  • Answer
  • May 31, 2022

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)  


martingaxiola
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • May 31, 2022

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 !


  • Freshman I
  • October 4, 2022

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.