Best answer

Could not create record of the "Lead" object: triggerLead: execution of BeforeInsert

  • 17 November 2020
  • 12 replies
  • 897 views

From time to time i get a stopped zapier with this error

 

Could not create record of the "Lead" object: triggerLead: execution of BeforeInsert

caused by: System.NullPointerException: Attempt to de-reference a null objectClass.LeadBO.leadMerge: line 774, column 1Class.LeadTriggerHandler.beforeInsert: line 46,

 

The thing is that is not happening everytime… what could be the cause of this issue?

icon

Best answer by nicksimard 23 December 2020, 00:14

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

12 replies

Userlevel 7
Badge +14

What apps and action steps are you using that result in this error?

Not sure what im supposed to reply but its facebook into salesforce

 

steps are:

  1.  New Lead in Facebook Lead Ads
  1. Code mapping in zapier
  2. Create record in Salesforce

 

Issue is happening in 2

@Troy Tessalone can you help me with this? if you need a log or something tell me how to get it ill paste it here

Userlevel 7
Badge +12

@Santiago M 

 

Null Pointer Errors are caused by objects that have not been instantiated. You could “fix” the error with an if statement that checks to make sure the object is not null before running that line. Otherwise, we will need to see the code and the data feeding the code to further help. 

sorry, im new to zapier, where is the IF statement supposed to go? in the facebook / Instagram form that goes to zap and then salesforce?

Userlevel 7
Badge +12

We would need to see the code mapping in step 2 to further help diagnose. 

@GetUWired , sorry for the delay in response, this weekend the error happened again

 

This is my step 2:

 

 

the lookup table continues

 

Sorry if this is not what you were asking for

Userlevel 7
Badge +12

@Santiago M When you are getting the error, can you share screenshots of the task history details? It is likely that your lookup key doesn’t have a value on those runs so it is throwing that error. 

@GetUWired can you show me an example screenshot of the info you need? because when i go to the task history i see several tasks going through OK and some of them with error, nothing more than that

 

 

is this what you are requesting?

 

 

Userlevel 7
Badge +12

@Santiago M This looks like an error from Salesforce. You can read a bit more about a similar issue on StackExchange https://salesforce.stackexchange.com/questions/154060/execution-of-beforeinsert-caused-by-system-nullpointerexception-attempt-to-de. Salesforce has documentation on their trigger actions https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm#:~:text=Apex%20triggers%20enable%20you%20to,update 
 

Userlevel 7
Badge +11

Hi @Santiago M!

I see in your screenshot that you’ve got this:

If you check other tasks that have errors and they all have that field missing, and the ones that succeed always have that field, I think you may have found your culprit.

Then you can see which field from Facebook Lead Ads populates that and if there are times when it won’t be present you can use Formatter by Zapier’s Default Value function (under the text section of Formatter) to make sure there’s always a fallback value.

You can read more about that in our help docs.

@nicksimard / @GetUWired , Yes,  that error is there everytime it fails, but i was thinking that the issue is originated in step 1 but it goes through step 3 where the error makes the lead stop

This is a screenshot of a section of the dataout of 1st step, see the missing fields in the 1st one compared to the 2nd one.

One of the missing fields is PLATFORM the one that i would assume is casusing the issue in my previous image

is this normal?