Add messages from JavaScript code by using the message bar addMessage
function:
dojo.widget.byId('messageBar').addMessage({type:"warning", summary:"An
error has occurred."});
To add a message that contains bulleted details, write your JavaScript similar to the following:
dojo.widget.byId('messageBar').addMessage({type:"error", summary:"An
error has occurred.", details:[{description: "First detail"},
{description: "Second detail"}]});