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
praveen rayala 7praveen rayala 7 

how to dealwith error messages in the controller

I am getting following message when i'm writting var error=result.getError();
[{"fieldErrors":{},"pageErrors":[{"statusCode":"FIELD_CUSTOM_VALIDATION_EXCEPTION","message":"Please generate Delivery Order for all the products"}],"index":null,"duplicateResults":[]}]
my question is how to get only messsage value??
Ravi Dutt SharmaRavi Dutt Sharma
var errors[] = result.getError();
var errorMessage = errors[0].message;

This should help. Ideally you should iterate over the errors array and get all the error message and display them on the component (if required).