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

Show error message



I have used a trigger within SFDC to check for duplicates leads. The leads are generated using the web to lead form included in our companies website. I would like to show the Message from the trigger in the website when a duplicate lead is being entered, what should be done.





Not much luck of that using the standard Web 2 Lead app.  As far as I'm aware, there is no way to pass back data from Salesforce.


But now a days, you have Salesforce Sites.  Create a custom VF page and use that to collect the data.  The VF page can display the outcome from the tirgger (or it wouldn't even need to be a trigger anymore since the VF page can just run APEX).


You can use adderror() method to add custom message in trigger. For more information you can refer Apex-guide documentation.