Showing Warning/ Success Messages in Suite lets

Scenario:

We need show a warning message when an error occurs and a success message if the process completed.

You can use ‘message‘ for showing warning/ information messages in a suitelet. ‘N/ui/message‘ module can be used for that.

let myMsg = message.create({
        title: 'My Title',
        message: 'My Message',
        type: message.Type.CONFIRMATION
    });
    myMsg.show({
        duration: 5000 // will disappear after 5s
    });

in the above example, we can create the message by using message.create method. As an option, you can specify which type of message are you going to show. message.Type has several other options like, error,information etc. show() is used to show the message. You can specify the duration of the message to display on the page.

Leave a comment

Your email address will not be published. Required fields are marked *