You can also display error messages (from the stack) but remember to call apex.message.clearErrors() before to clear the stack.
There's one input parameter:
@param {Array | Object} pErrors Error object, or an array of error objects to add to the error stack. Object in the following format:
[
{
"type": "error",
"location": "page",
"message": "Page error has occurred!"
}
,{
"type": "error",
"location": ["inline","page"],
"pageItem": "P13_ENAME",
"message": "Ename is required!",
"unsafe": false // if unsafe : true, then we escape it here, else false
}
]
Sample code:
apex.message.clearErrors();
apex.message.showErrors(
[{
"type": "error",
"location": ["inline","page"],
"pageItem": "P13_ENAME",
"message": "Ename is required!",
"unsafe": false
},
{
"type": "error",
"location": "page",
"message": "Page error has occurred!"
}]
)
***Note: When you clich button Show Errors they are displayed on top of the page, so you need to scroll up.