Class: Notification

otris.notifications. Notification

Create a new notification

Constructors

Name Type Description
message string optional

message

title string optional

notification title

type string optional

notification type

action otris.ScriptReturn optional

Add a click action for the notification

sticky boolean optional

Remove notification only if closed or clicked (otris.notifications.NotificationDefaults.sticky)

  • Since:
    • Documents 5.0d
Examples
// #import "Notification_API"
var loginName = "schreiber";
var notification = new otris.notifications.Notification("Just a test... " + (new Date()).toISOString(), "My title");
notification.publish(loginName);
// #import "Notification_API"
// Create a progress notification
var loginName = "schreiber";
var notification = new otris.notifications.Notification("My custom message", "My custom title");
// Set the type to "progress"
notification.setType("progress");
// Set the current progress as a value between 0 and 100. see setProgressValue() for details
notification.setProgressValue(10); 
// All progress notification concerning the same task must have the same referenceId
notification.setReferenceId("myCustomProgress007");
notification.publish(loginName);

Methods

publish(user)

Publish the notification to the given user(s)

Name Type Description
user string | SystemUser | Array.<string> | Array.<SystemUser>

recipients

setAction(action)

Set the click action of the notification

Name Type Description
action otris.ScriptReturn

notification onclick action

setMessage(message)

Set the notification message

Name Type Description
message string

message

setOnloadAction(onloadAction)

Set the onload action of the notification

Name Type Description
onloadAction otris.ScriptReturn

notification onload action

setProducer(user)

Set the user who produced the notification (e.g. the author of a file message)
Defaults to the current system user

Name Type Description
user SystemUser optional

system user

  • Since:
    • Documents 5.0d HF2

setProgressValue(progressValue)

Set the current progress value for a long running task. Set a value between 0 and 100.
A value over 100 means the task is done and was successful.
A negative value indicates that the task failed.
The notification type must be set to progress.
It is also necessary to set a referenceId as a identifier for the task.

Name Type Description
progressValue Number

current progress

  • Since:
    • Documents 5.0e

setReferenceId(referenceId)

Set a referenceId for the notification

Name Type Description
referenceId string

reference id

setRemoveOnAction(removeOnAction)

Remove the notification if action is executed

Name Type Description
removeOnAction boolean

remove on action flag

setSticky(sticky)

Remove notification only if closed or clicked (otris.notifications.NotificationDefaults.sticky)

Name Type Description
sticky boolean

sticky flag

setTimeout(timeout)

Set the timeout for this notification

Name Type Description
timeout number

notification timeout

setTitle(title)

Set the notification title

Name Type Description
title string

notification title

setType(type)

Set the type of the notification

Name Type Description
type string

notification type