i want to give link to the record in an error message which i am sending from trigger.
Message:
ERROR: An open opportunity <a href='https://bonial3-dev-ed.my.salesforce.com/0065i000006VOl0AAG'>Dickenson Mobile Generators</a> already exist, please close it first before creating new.
code:
String url = URL.getOrgDomainUrl().toExternalForm()+'/'+opportunityList[0].Id;
opp.addError('ERROR: An open opportunity <a href=\''+url+'\'>'+opportunityList[0].Name+'</a> already exist, please close it first before creating new.',false);
I have tried almost all the soln given on :
how to add email id as hyperlink in trigger error message?
https://stackoverflow.com/questions/11615794/hyperlink-in-trigger-error-message
How to display a error message with hyperlink on standard detail page through trigger
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A7ckfSAB
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8D8tSAF
update: found one thing this code is working in classic but not in lightning.