I'm facing a weird issue in our customer org. We try to update some lead objects in our managed package after some processing. We are seeing that sometimes the objects are updated successfully whereas other times we are getting the below Error while updating the objects

ERROR : FIELD_CUSTOM_VALIDATION_EXCEPTION: Attempt to de-reference a null object ERROR : Fields that affected this error: ()

We are not able to pin point which field is causing this issue since it does not show which field causes the problem and there are other apps on their org as well which are updating the lead object.

Also when new leads get created, the previous ones that were failing now start getting successfully updated. Not sure how to find the field that is causing the issue or how to debug this further, any thoughts?

2 Answers 2


This is a generic exception that basically means the developer neglected to check for a blank value ("null", in programming parlance) before trying to use the value, and also failed to properly handle the error. It may be unrelated to any specific value you're loading and just the state of the system in general, making this a particularly troublesome error to try and debug.

You cannot fix this error, and you may not be able to identify which field is causing it except by experimentation, or perhaps writing a unit test, assuming it is your data and not something else. Your best option is to contact the app's publisher, and work with them on determining the cause. Salesforce's "intellectual property" protection mechanisms make it specifically impossible for you to debug this directly.

Assuming they have passed the Security Review, they can log in to your org (with your permission) and get enhanced debug logs that can help them discover the problem. If this managed package has not passed a security review, the best you can do is complain to the ISV and hope they fix it.

  • Thanks @sfdcfox. The error is happening during save in our managed package when saving leads, I'm trying to figure out whether this error is happening at our end? For eg, if we do a query like - [Select id, our_managed_package_field from Lead]; and try to save lead objects, even if we are not querying for custom fields from other packages, could they affect the save of these objects?
    – user1104
    Aug 22, 2018 at 11:29
  • Also when you say the developer may have negelected a blank value, the question is even if you try to save a null value to a field, the save should go through right? For eg. lead.custom_field = someObj; if someObj is NULL, it still shouldn't cause any issues right. Or do you mean - lead.custom_field = someObj.someField__C where someObj is NULL. In this case, the error should be in the managed package right during reference, rather than while doing a save?
    – user1104
    Aug 22, 2018 at 11:35
  • @user1104 No. During the Triggers and Order of Execution life cycle, the very first step loads all fields for the record from the database into the trigger context, so even if you specify no fields other than ID, the trigger would still see all the values for the record.
    – sfdcfox
    Aug 22, 2018 at 11:35
  • sorry I didn't really get what 'No' was for? :)
    – user1104
    Aug 22, 2018 at 11:38
  • @user1104 No was in response to your first comment... for the other question, someObj.somefield__c where someObj is null is a NullPointerException. If you can't see where the exception is thrown from in the debug logs, it's not your fault. If you can, then you should be able to go to the line of code that threw it and fix it.
    – sfdcfox
    Aug 22, 2018 at 11:41

I had the same error but with my own code. Removing the try-catch block resolved it for me.

If you use a debug log, you can see just before the error which trigger ran last, then remove all the try-catch blocks from the trigger and you'll be able to see the full trace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.