Exactly. In that case, gs.addErrorMessage() is only responsible for displaying the validation message; it doesn't by itself control the Flow execution.

 

For a server-side validation, the cleaner approach is to have the Action Assignment return a validation result/status and handle that result before continuing with the next Flow step.

For example:

Validate >> Error? >> Show message / stop >> Otherwise continue

 

You should avoid relying on gs.flushMessages() for the control flow. The important part is to explicitly return a success/failure result from the server-side validation and use that result to prevent the subsequent actions from executing.

 

This keeps the validation server-side and avoids introducing a client-side dependency.