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
RajnisfRajnisf 

Custom Lightning Action does not display validation error messages

Hi All,
We have a custom action button in lightning for Lead convert.
Issue is on clicking the convert button (custom) it does not display error message (for example status is mandatory etc). it simply refresh the page with the model box and lead does not convert.
In debug logs .. validation error message is there...
In Lead settings, Require Validation for Converted Leads is also Checked..

Please suggest!!
Thanks
Best Answer chosen by Rajnisf
RajnisfRajnisf
Thanks Veena,
We were able to do that...
here is the link whick helped a lot..

http://www.terrasky.com/how-to-handle-apex-errors-for-lightning-component-implementations/

 

All Answers

Veena Sundara-HeraguVeena Sundara-Heragu
Can you share the code for the lightning component and apex controller ?  For exceptions from the apex controller to be displayed, you need to catch the exception and generate an @AuraHandledException lie this:

    @AuraEnabled
    public static void apexMethod( )
    {
        try
        {
            // Your code here
        }
        catch (Exception ex)
        {
            throw new AuraHandledException('Exception occured:\r\n' + ex.getMessage() + '\r\n' + ex.getStackTraceString() + '\r\n');
        }
    }
 
RajnisfRajnisf
Thanks Veena,
We were able to do that...
here is the link whick helped a lot..

http://www.terrasky.com/how-to-handle-apex-errors-for-lightning-component-implementations/

 
This was selected as the best answer