Skip to main content
Question

Dealing with data not found

  • October 20, 2025
  • 13 replies
  • 55 views

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+7
  • Captain II
  • October 20, 2025

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.


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • October 20, 2025

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


Forum|alt.badge.img+7
  • Captain II
  • October 20, 2025

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.


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • October 20, 2025

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)"

        }


Forum|alt.badge.img+7
  • Captain II
  • October 20, 2025

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.


Forum|alt.badge.img+8
  • Captain II
  • October 20, 2025

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


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • October 20, 2025

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


Forum|alt.badge.img+8
  • Captain II
  • October 20, 2025

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


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • October 20, 2025

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


Forum|alt.badge.img+8
  • Captain II
  • October 20, 2025

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


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • October 20, 2025

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)"

        }

 

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • November 6, 2025

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


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • November 6, 2025

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

Not yet. :(