You need to sign in to do that
Don't have an account?
Html in addError()
Hi,
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];
if(acc.size()>0)
{
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.id+'">'+at.Name+'</a>', FALSE);
} }
}
}
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];
if(acc.size()>0)
{
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.id+'">'+at.Name+'</a>', FALSE);
} }
}
}
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:
https://developer.salesforce.com/forums/ForumsMain?id=906F000000096mcIAA
https://www.salesforce.com/us/developer/docs/pages/Content/pages_styling_salesforce.htm
https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_message.htm
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal
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.
https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices