On Embedded Form Error, can you prevent the overlay notification from appearing? (CamSDK Notifications)

If there a way to programatically prevent the popup from appearing?

Screen Shot 2020-09-02 at 6.28.16 PM

I am looking to do this with JS within the form

@Niall anyone camunda can provide some insight on this?

Hi @StephenOTT,

you can use inject to get the Notification service:

    <script cam-script type="text/form-script">
        inject(['Notifications', function(Notifications) {
            var consumer = {
                add: function(notification) {
                    console.log(notification);
                    // Filter if you want to handle/intercept the notification
                    // Return true when handled, false otherwise
                    return true;
                },
                remove: function(notification) {
                    // Remove the Notification
                }
              };

              Notifications.registerConsumer(consumer);
          }]);
    </script>

This way, you can intercept all notifications and suppress (or display in your form) all that you don’t want to show. Notifications are Objects and look like this:

{
exclusive: Bool
message: String, Body of the Notification
scope: Scope
status: String, basically the title
type: String
}

Please note that the Notification service is not part of the public API and might change in future releases.

Cheers
Martin

2 Likes

Thank you. Very helpful.