1

I call a service function inside the performAction method of custom element-action and I'd like to show an error message to user if the service function returned false.

I was able to set success message by using:

$this->setMessage($this->getParams()->successMessage);

But I don't know how to set an error message i.e. with red background.

1 Answer 1

1

I know this is a late reply. I hope it will help others.

You need to return false; so that the background color is red.

Example:

     if (count($criteria->ids()) > 1)
     {
         $this->setMessage($this->getParams()->warningMessage);

         return false;
     }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.