Which actions are available to sort Apple Mail by Date Received and also by Flag Color?
There's the Set Mail Status action.
And then there's the Select or Show a Menu Item action.
And some of these things can be accomplished via AppleScript as well.
Execute an AppleScript action.
For more information, see the wiki Searching the Forum for Answers section.