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
Afrose AhamedAfrose Ahamed 

How to override system validation error

Hi All, 
When lead conversion if i choose existing opportunity its showing me this error (There was an error converting the lead. Please try again. If the problem persists, please contact your administrator.)  I know why this error causing due to if lead currency and opportunity currency are not same then this error will show. But this is very difficult to understand for users.  So i wrote a trigger to show custom error. When i try with other fields its showing the error what i need to show. But if try to show for currency field its showing system error not my custom error. How can i override system error. 
//just for testing to check trigger LeadCurrencyTrigger on Lead (Before insert,Before Update) {
 list<lead> ls=new list<lead>([SELECT LastName, Email, CurrencyIsoCode,AfroseDev__CurrencyISO__c, IsConverted, ConvertedAccountId, ConvertedContactId, ConvertedOpportunityId FROM Lead]);
            String acid = ls.ConvertedOpportunityId;
                for(Opportunity Ac: [select id,Name,CurrencyIsoCode, AfroseDev__CurrencyISO__c from Opportunity where id=:acid] ){
       [0].adderror('Please select different location');

Also i tried i created one formula field on lead and one formula field on opportunity to store currencyISO value and i tried calling to show my custom error but still im getting system error. How can i acheive this please help. 
Afrose Ahamed M.G.