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
LakshmanLakshman 

WebToLead trigger not firing

Hi All,

 

I have a trigger which assigns Leads generated from web to owner on some conditions. My trigger works when I insert from Salesforce but it doesnt works if I assign from WebToLead form. It defaults to the owner present in Lead setting.

 

My trigger is on lead before insert which works fine for normal insert from Salesforce but not from WebtoLead form.

Not sure but curios to know if this a bug?

 

Please help me on this

 

Thanks,

Lakshman

dmchengdmcheng

So you are checking the LeadSource field for the value of "Web"?  I wonder if you are running into a similar problem I had with Web to Case - The Origin field in Case is empty during BeforeInsert and is only set to "Web" after the Case is created.  My BeforeInsert trigger had to use some other field to determine that the case was coming from the web.

 

You might set a hidden custom field on the Web To Lead and see if that works for your trigger.

LakshmanLakshman

No I am not checking the LeadSource field. I have a custom field to check and then assign to User's or Queue's as per conditions and toggle lead owners  as per some other conditions. After assignemnt I send email alert to the owner as well.

 

But this doesnt works when I insert from WebToLead form. Though it works perfect for manual insert from salesforce.

 

Any thoughts/ideas, how can I make it work?

 

Regards,

Lakshman

dmchengdmcheng

I can only suggest using system.debug or the new Developer Console's simulated breakpoints to examine the lead's values as it enters the BeforeInsert trigger and try to see why it's not being processed.

LakshmanLakshman

I tried printing the values and got an error from SF salying that, Salesforce was unable to process your lead null/ Salesforce will try creating lead after sometime.

 

I think it is due to null pointer exception, I printed System.debug(objLead.Type__c+'<<<<My Field');

 

This CustomField Type__c is commig null before insert of trigger from Web and it gives me desired value when we insert through Salesforce. I dont know what's happening. I have also contacted Salesforce regarding and think they are trying to find our whats happening.

 

This is really weird. Let me know if you have any other thoughts to fix it.

 

Regards,

Lakshman

 

ClaiborneClaiborne

Did this work before, and suddenly stopped? I am seeing the same behavior on another organization.

LakshmanLakshman

David,

 

It never worked for me. I am happy that you have seen this working in your some org. I think it may be a bug in recent release and should be fixed soon.

 

Let me know if you get any updates/workarounds on this.

 

Regards,

Lakshman

Roshan SahatiyaRoshan Sahatiya

Guys, I am also getting the same thing.

 

I am not able to get the 'Origin' field in the case of Web to Case (Before Insert Trigger)

 

Have you guys got any solution?