I encountered a weird issue which i wanted to get feedback from you guys. Currently we have 2 sandboxes where we are doing development currently. We are experiencing an odd behavior where none of the database insert or upserts are working. When we do a database.insert or upsert, there is no exception . We also get an ID but when do a soql query or look up on the url by id, we are not seeing any data at all.So the try catch thinks there is no exception but there will be no record in the custom object at all.
Our current application is a multistep wizard which runs across 60 pages step by step. On each page there is a next and previous button. On next button click, our application queries a custom object database to figure out the next page and previous page. It also features to jump to a page or loop through one page multiple times. So here is our question.
In our code, we currently rely on 2 custom objects to be inserted on the starting of the page. The reason for this problem was that some where our code was throwing a null pointer but Salesforce rolled back the entire transaction. So what are the situations or conditions apex is looking to do a database rollback ? What triggers it? In our case, we got the id and no exception but the record never existed in the database at all.
The debug logs currently do not have any trace of a database roll back and so we need to know where can we see that the database transaction has been rolled back?
If our code has a run time exception like a null pointer, how can we force apex to still commit the database transaction and insert the record? What object and method with parameter should we use for it?