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
BhawnaBhawna 

Custom Validation rule error

how can we handle custom validation rule exceptions in Batch APEX? I've used Batch in my code, but after deploy of code, user has placed a validation rule on that object. Now in my batch apex script I'm executing DML statements which are now causing Exception email sent to me for not able to update values. Is there any way I can display the error messages to User on screen?

dev401hasdev401has

Hi

 

I am not sure but can't you use try catch throw?

You can kep the code in try which is generating exception. Catch the exception msg and throw it on the screen using Apex.pagemessages

 

VarunCVarunC

No, that will not work, since Batch APEX is asynchronous by nature thus no UI interaction of validation sort can be done :( ....