How to Add a Warning instead of an Error in a validation?

I implemented a validation that checks if one has enough leave balance and returns error when requested days are more than the balance a person has.

But now, there’s a need to show a warning instead of an error and allow the request to be submitted so that the approver will be the one to decide whether to approve or deny.

How can I achieve this? Ash document says that validation does 2 things: 1) Add an error, or
2) Continue.

It would be nice to do this in a validation if possible.

Unfortunately there is no way to do this with validations. You would need to use change, and add something to the changeset or the resulting record to display this warning in some way.

1 Like