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
Nick PaivaNick Paiva 

UNKNOWN_EXCEPTION: java.lang.NullPointerException - Lead Conversion

Hey Team,

I've been countering a strange issue--currently I'm working with support to try to figure it out, but we're hitting walls. 

I'll give the quick version first, and then more details below if you need it.

I have a super simple process builder: When a lead is converted, update a field on the contact it's converted into. However, I'm getting the error above.

---

Details:

First off, every solution built in webdev seems to work; however, it does not work in product. We've done a sandbox refresh just in case, but the process still works in webdev, but not production.

I've narrowed things down as far as I can, and I think I've come to this root cause:

It's specifically the lead conversion. For instance, I decided to bypass the process builder and build out what I'm trying to do in a flow, so I can test some more. You'll see the image attached that the update process fails. All the update process does is reference the converted contact ID (pass through Process builder) to update that contact's field.

It fails--super simple, though. You can even see in the log that it does capture the ID. 

So, I decided to use the debug method in Flow and hardcode that ID into it, and the process works just fine. Which leads me to believe that the issue is with the ID being passed through the lead conversion.

But I can't think about what the issue may be in this instance.

Has anyone ever encountered this error before and has some experience troubleshooting it?

(Also, the PB is simply: When lead is created or edited; is it converted?; launch flow. While testing, I don't have any other Lead related PBs active).

Thanks,
Nick

User-added image
Nick PaivaNick Paiva
Also, extra info: this error only happens when I'm converting a lead into a prexisting contact. If the lead is converted into a new contact, it converts just fine.
Salvatore Marra 4Salvatore Marra 4

Hi Nick,

I'm facing the same issue on Production.
Did you solve the problem?
 

Let me know please it's pretty urgent...

Thanks!!
Salvatore

Matt Bostrom 2Matt Bostrom 2
same here for our org... i have a process builde running but checks if the field in he update action is null first so it shouldnt be hitting this. any updates?
Ankita Jena 7Ankita Jena 7
Hi,

Did you get the solution for this?

Regards,
Ankita
Nikolay Denizhenko 8Nikolay Denizhenko 8
Hi Nick,

Any luck with this issue? Or maybe you've found a workaround for it?

Thanks,
Nikolai
Da ChengDa Cheng
Hi Nick,

Same issue. Did you get solution for this?
it only appeared in Production, Sandbox works fine.
So strange.
Salvatore Marra 4Salvatore Marra 4
Hi everyone,

try to get in touch with Salesforce Support and make sure that your processes are not the cause of the problem.
It seems to be a standard Salesforce error about conversion.

Salvatore
Zoran Basic 1Zoran Basic 1

Hi,
We have been experiencing this error at least 1 or 2 years. If we convert a lead into existing contact we receive this same java.lang.NullPointerExpception. Sam as you, it happens only in production.

I'm not sure it has anything to do with flows, I tried disabling them on production, but no change. We have some managed plugins and various stuff on contacts and leads, so any of them can cause it. We never found the culprit or solution.

Abhishek Khosla 32Abhishek Khosla 32
Hi,
We are also facing an issue in org did anyone got any solution for this. did you guys created a case with salesforce to understand the issue 

Thanks 
Abhishek 
Magdalena FiluszMagdalena Filusz
Hi,
We have the same issue. Did anyone find a solution?
Regards,
Magda
Sarita PamulaparthiSarita Pamulaparthi
Hi All,
we had same issue upon lead conversion.
There is field mapping happening on  XXX__c between Lead and Contact. Along with it, on Contact object XXX__c field is updated by flow. 

This results to "This error occurred: UNKNOWN_EXCEPTION: java.lang.NullPointerException".. When I deactivated the Contact flow, the lead conversation did not result to error message. 

Hope this help you. 
 
ShafiShafi
Hi All, 
we have the same issue in our org as well. 
  • Just happens in production 
  • on conversion of lead to existing contact 
is there anyway to escalate this issue to salesforce ?
Ramkumar RRamkumar R
Lead conversion sometimes runs on system context(at java layer) and might run into this null.pointer exception at the java layer. Please contact Salesforce Tech support team to enable the permission 'Enable matching in normal context for Lead convert' for your org