Skip to main content
Question

Dealing with data not found

  • Oct 20, 2025 3:26 PM UTC
  • 13 replies
  • 112 views
  • Translate All

Forum|alt.badge.img+1

Hi all,

 

I update Project task Status completion from our builder software. Sometime the Project number gets entered incorrectly into that app.  Whe I run a put to the ProjectTask endpoint and the project does not exist it give a 500 error with "exceptionMessage": "Object reference not set to an instance of an object."

I am logging these, but it is not a very friendly message. I do not want to hit the API first to see if the project exisits. We are going to automate the Project creation so they are all in Sync, but not till next year.

 

My questions is how are you dealing with this type of issue?  My concern is the generic Error my not always mean the project does not exists.

13 replies

Forum|alt.badge.img+8
  • Captain II
  • Oct 20, 2025 4:08 PM UTC

Do you have any customizations in the projects area? If you do, that might be where the error is coming from and some additional error trapping needs to be implemented.

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Oct 20, 2025 6:36 PM UTC

are you saying that should not be what I get when the project is not found?

Translate

Forum|alt.badge.img+8
  • Captain II
  • Oct 20, 2025 6:52 PM UTC

Correct, I wouldn’t expect that error to be the result of a call where the project no. supplied in the json doesn’t exist.

That error will happen in the major of two cases:

  1. A bug in the code where a variable wasn’t initialized properly before being used.
  2. That an assumption was made that the incoming data was perfect and didn’t need to be validated.

I suspect that you’re facing that second case. Given that when setting up a project that the Project Code for the non-primary views is handled internally and not typed in by the user, it would be easy to make the relatively safe assumption that the project code will exist when you’ve got other business logic in the graph. But since you’re using a different interface - the REST Api I’m thinking that if you do have a customization in place, it might have assumed that the project code was correct and didn’t validate the project code itself.

That’s why I asked if you have any customizations that might be involved.

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Oct 20, 2025 7:12 PM UTC

I see what you are saying and it is a custom endpoint with a few other columns added.  But if I use the default endpoint  /entity/Default/23.200.001/ProjectTask,  Put Method,  and try to update the Description of a project that does not exist, I still get:

 

"innerException": {

            "message": "An error has occurred.",

            "exceptionMessage": "Object reference not set to an instance of an object.",

            "exceptionType": "System.NullReferenceException",

            "stackTrace": "   at PX.Objects.EndpointAdapters.DefaultEndpointImplPM.ProjectTask_Insert(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"

        }

Translate

Forum|alt.badge.img+8
  • Captain II
  • Oct 20, 2025 7:20 PM UTC

The customizations I was referring to would be found in the Customization Projects screen.

I should be clear in that you might have found an unattractive error. :)  

I know you mentioned that you didn’t want to send a call to the Projects end point to validate but that might be your best bet to avoid bad data coming through.

Translate

Forum|alt.badge.img+11
  • Captain II
  • Oct 20, 2025 8:31 PM UTC

​@keithschm 

 

Do you GET the data from your builder software or POST the data from your builder software?

 

Dependant on if you have access to the Acumatica DB when you are doing these calls, you can check whether the Project ID exists before attempting to make any changes. If the project does exist, you can proceed with the changes, if it does not exist, you can make it throw an error which states the project does not exist.

 

If you do not have access to the DB directly, you could try to perform a GET call to the project endpoint to find the projects and if any projects do not match, then you could also throw an error which states the project does not exist.

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Oct 20, 2025 8:55 PM UTC

Our Acumatica instance is in the Cloud. I am trying to limit the amount of API calls to the Cloud

Translate

Forum|alt.badge.img+11
  • Captain II
  • Oct 20, 2025 9:52 PM UTC

Understood, do you use a dev environment to develop customisations or are you doing this via a pre-built integration?

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Oct 20, 2025 9:59 PM UTC

There is no customizations, just an extended webservice endpoint with some added fields. If I use the default webservice endpoint I still get the same thing

Translate

Forum|alt.badge.img+11
  • Captain II
  • Oct 20, 2025 10:04 PM UTC

Do you have access to the API call that the builder software is making? If so, could you share it?

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Oct 20, 2025 11:07 PM UTC

Thank you for the help, the issue I am having is with the Acumatica API.  If I use Postman and call the default Endpoint 

/entity/Default/23.200.001/ProjectTask,  Put Method,  and try to update the Description of a project that does not exist, I still get:

 

"innerException": {

            "message": "An error has occurred.",

            "exceptionMessage": "Object reference not set to an instance of an object.",

            "exceptionType": "System.NullReferenceException",

            "stackTrace": "   at PX.Objects.EndpointAdapters.DefaultEndpointImplPM.ProjectTask_Insert(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"

        }

 

 

Translate

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • Nov 6, 2025 6:16 PM UTC

Hi ​@keithschm were you able to find a solution? Thank you!

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Nov 6, 2025 7:14 PM UTC

Hi ​@keithschm were you able to find a solution? Thank you!

Not yet. :(

 

Translate