function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Morgan MarcheseMorgan Marchese 

Test Class failing because record is apparently being deleted immediately after creation - any way to track it down?

I made some major changes to a handler class that references custom objects from a managed package and it no longer passes 75% coverage so I needed to add a lot of test coverage to handle it. In my test coverage I created a new account, new opportunity linked to that account, new zuora quote (managed package) linked to the opp and account, and new quote charges (managed package) linked to the zuora quote.

However, the test class fails with an error on attempting to de-refernce a null object on the line that is supposed to insert the quote charges (last object). Coincidentally, that is the object that I need to insert to increase coverage. While investigating, I went into SFDC and manually created a quote charge and saved it. After I press save, it immediately tries to load the newly saved record but instead brings me to the page that says:

"The record you attempted to access has been deleted. The user who deleted this record may be able to recover it from the Recycle Bin. Deleted data is stored in the Recycle Bin for 15 days."

What is the easiest/best way for me to determine how/why these records are being deleted immediately after creation?
Tugce SirinTugce Sirin
You can check debug logs to check on what's happening. To see debug logs write Debug Logs in search box and add your user to get a log. Then create a quote charge and save it. When you go to debug logs there will be a new log about it. You can see what is causing this problem from there.