Skip to content

3.2.3. Messages

Ettiene Mare edited this page Mar 6, 2020 · 7 revisions

Polaris Workflow and Polaris Workflow Analytics will send window post messages.
You can send these messages to your application or analytics collector.
You can display or hide a loader for example, see the example.

Specification

The message will be in the following format.

export interface Message {
    type: 'PROCESS_CHANGED' |
          'START_LOADING' |
          'END_LOADING' |
          'ERROR' |
          'VALIDATION_ERROR' |
          'WORKFLOW_CHANGING' |
          'WORKFLOW_CHANGED' |
          'UN_AUTHORIZED';
    description?: string;
    metadata?: {
          process: string?,
          activity: string?,
          activityType: string?,
          timestamp: number
   }
}
Metadata Description
process The name of the process.
activity The name of the activity.
activityType The type of the activity, page-activity for example.
timestamp The time stamp of the message.

Add the following script to listen to the messages.

<script>
    window.addEventListener('wfMessage', (event) => {
        const msg = event.detail;

        switch (msg.type) {
          case "ERROR": return this.logAnalytics(msg);
          .....
          .....
          case "WORKFLOW_CHANGED": return logAnalytics(msg);
        } 
    });
</script>

Messages

Message Description
ERROR An exception occurred in the flow.
UN_AUTHORIZED You are not authorised to access the remote resource, you must login.
START_LOADING A long running process started, a http call for example.
END_LOADING The long running process is finished.
PROCESS_CHANGED A new process is loaded.
VALIDATION_ERROR A validation on your form failed.
WORKFLOW_CHANGING A new activity is going to be executed.
WORKFLOW_CHANGED The new activity has been executed.

Home

  1. Setup

  2. Configure

  3. Design

    3.1.Introduction

    3.2. Core

    3.2.1. Workflow
    3.2.2. Analytics
    3.2.3. Messages

    3.3. Services

    3.3.1. Workflow
    3.3.2. Analytics
    3.3.3. Config
    3.3.4. Model
    3.3.5. Validator
    3.3.6. Http

    3.4. Validators

    3.4.1. Required
    3.4.2. Regex
    3.4.3. Range
    3.4.4. Custom

    3.5. Pipes

    3.5.1. Currency

    3.6. Activities

    3.6.1. Page
    3.6.2. Api
    3.6.3. Assign
    3.6.4. Decision
    3.6.5. Code
    3.6.6. IPC
    3.6.7. Finish
    3.6.8. Redirect
    3.6.9. Switch
    3.6.10. Custom

    3.7. Web Components

    3.7.1. React

Clone this wiki locally