How to set error message in element action? 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-&gt;setMessage($this-&gt;getParams()-&gt;successMessage);


But I don't know how to set an error message i.e. with red background.
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-&gt;ids()) &gt; 1)
     {
         $this-&gt;setMessage($this-&gt;getParams()-&gt;warningMessage);

         return false;
     }