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
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri 

Html in addError()


can any one help us....

we need to print multiple duplicate account names(with hyperlinks), but it displaying error for only one account

trigger DuplicateAccountNameCountryCheck1 on Account (before insert, before update)
    For(Account a:Trigger.New)
        List<Account> acc=[SELECT Id, Name FROM Account WHERE BillingCountry=:a.BillingCountry];
        for(Account at:acc){
           a.addError(' <font color="blue"> im an html error with a  </br></br>this is</br> </br> false</font><a href="/''">'+at.Name+'</a>', FALSE);
        } }
Vatsal KothariVatsal Kothari

You can not do this in the trigger , apex class or with standard page, for this you have to create Visualforce page.

you can refer below links:

If this solves your problem, kindly mark it as the best answer.


You need to flow best practise as you are using soql in for loop which is not good practise and it may cause for a problem.