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
Eric_HDCEric_HDC 

Web2Lead : dealing with error message

I have a Web2Lead form and on the SFDC side I have a trigger that prevents duplicate leads from being inserted (based on email address, lead source, and date).  In SFDC, when I create a duplicate, the addError message shows up and it's all good.

 

On the website (Web2Lead form), the duplicate submitted is not inserted (i.e. the trigger works fine), but the error message from the addError is displayed on the web page!

 

Is there a way I can force-redirect the web user to the regular thankyou page, or does that have to be done by the web developer in charge of the the landing page?

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
Are you using web to lead, or a web to lead using API? The error shouldn't appear for web to lead, because they are submitted to a queue and the thank you page automatically appears. If they are using the API, they will need to adjust their code accordingly.

As a side note, it might be worthwhile to merge the new lead into the existing lead on an after-insert trigger instead. This will leave your submissions in the recycle bin instead of discarding them silently.

All Answers

sfdcfoxsfdcfox
Are you using web to lead, or a web to lead using API? The error shouldn't appear for web to lead, because they are submitted to a queue and the thank you page automatically appears. If they are using the API, they will need to adjust their code accordingly.

As a side note, it might be worthwhile to merge the new lead into the existing lead on an after-insert trigger instead. This will leave your submissions in the recycle bin instead of discarding them silently.
This was selected as the best answer
Eric_HDCEric_HDC
Thank you, sfdcfox!