Sending Web Application Notifications

Notifications are sent when some CRUD operation is performed. By using the Notifications feature, you can send notifications to users using the same application.

Example:

Suppose 3 users are working on the same task, creating a resource. When a resource is created by user 1, users 2 and 3 should be notified.

Steps:

  1. Create a JavaScript that calls the CreateNotification API.

    Sample JavaScript:

    context.log("creating notification for input: " + input);
    var result;
    if (input.actionName == "insert") {
    var createNotification = context.getApi("CreateNotification");
    createNotification.input = input;
    createNotification.execute();
    }

  2. Apply this JavaScript as a Post Persistence API to the Resource Entity.

    Navigate to:

    Resource Entity > Properties Panel > Persistence > Post Persistence API Name

  3. Save the entity.

When the web application is running and a new resource is added, notifications are sent to the other users.