How can I add an email id as a hyperlink in a error message in a trigger?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Triggers are executing when your data is manipulated, from whatever context (UI or API). It would be a bad design to assume which interface is the source of your trigger execution and create user specific messages at that point.
That beeing said, that doesn't always applies to salesforce, as for standard pages you don't have the luxery of running custom controllers, and validation rules kinda skip the same principle.
ALSO: mailto hyperlinks are not perceived as user friendly by most users and often only work well with device installed email clients, and not with web email clients (I believe).
Found this similar post on success community.
You can use apex:pageMessage tag with escape="false" then use try catch to catch the error from trigger and format the error putting html tags for email id. Now apex page message will display hyper link