Notification

◷ Reading Time: 2 minutes

notification

Retrieves the notification in default or a specific group that has some notices.

 notification (type, group)
  • type (string): the type of message (Optional)
    • error: Errors or exceptions notifications
    • warning: Warning notifications
    • info: General information notification
  • group (string): the group name of the notification. When not specified, the default group is chosen. (Optional)

You can pass * for a type or group that queries all the types or groups

Example: notification ('error', 'billing')

Result:  
[
     {
         "Type" : 3,
         "Tag" : null,
         "Message" : "name validation error",
         "Properties" : {}
     },
     {
         "Type" : 3,
         "Tag" : null,
         "Message" : "accout number validation error",
         "Properties" : {}
     }
 ]

There are 2 error notifications under billing group. Notifications can be written using the function, notificationWrite.
Example: notification ('error', '*')

Result: A list of all the error notifications

notificationWrite

Writes a message with a specific type in a notification

 notificationWrite (type, message, group)
  • type (string): type of the message (Mandatory)
    • error: Errors or exceptions notifications
    • warning: Warning notifications
    • info: General information notification
  • message (string): the message to be written in a notification. It can be parameterized string (Mandatory)
  • group (string): name of the group in the notification (Optional)
Example: notificationWrite ('error', 'name validation error', 'billing')

Result: It writes an error notification under billing group. The message can be retrived using the function, notification.
Example: notificationWrite ('information', 'Project A amount retrieved', 'Project_A_database')

Result: It writes an information notification under Project_A_database group. The message can be retrived using the function, notification.

notificationClear

Clears all of the notifications from all the groups based on the notice type.

 notificationClear (type)
  • type (string): type of the message (Mandatory)
    • error: Errors or exceptions notifications
    • warning: Warning notifications
    • info: General information notification
Example: notificationClear ('error')

Result: Remove all the error notifications
Updated on January 13, 2021

Was this article helpful?

Related Articles