Global events are used as a trigger that executes different client scripts. These scripts may call various actions, for example, to open a created record.

activityFeedCommentTabChanged


The event occurs after the comment tab in the Activity Feed widget has changed.

Return:

TypeDescription
Object

This method returns a widget with the previous value and the current value of the tabs.

{
	previousTab: 'previous',
	currentTab: 'current',
	widgetInstanceId: '10000001',
}

Example:

on
SimpleEventBus.on('activityFeedCommentTabChanged', async (obj) => {
  const previousTab = obj.previousTab;
});

afterLoadBreadcrumbs


The event occurs after the breadcrumbs are loaded.

Return:

TypeDescription
Object

This method returns nodes URL.

{
  'currentNode': {
    title: 'current Title',
    url: '/current',
  },
  'previousNode': {
    title: 'previous Title',
    url: '/previous',
  }
}

Example:

on
SimpleEventBus.on('afterLoadBreadcrumbs', async (obj) => {
  const backUrl = obj.previousNode.url; 
});

afterLoadWidgets


The event occurs when all widgets are loaded.

Return:

TypeDescription
BooleanThe event returns a boolean value (true or false).

Example:

on
SimpleEventBus.on('afterLoadWidgets', async (obj) => {
  if (obj.name === 'active' && obj.isValid) {
    // do something
  }
});

afterSaveEvent


The event occurs after a form is saved.

Return:

TypeDescription
Object

This method returns a form object

{
  "payload": {
    "view": "Default",
    "tableName": "task",
    "recordId": "166307559406494736",
    "displayValue": ""
  },
  "result": "OK"
}

or errors

{
  "payload": {
    "errors": [...]
  },
  "result": "ERROR"
}

Example:

on
SimpleEventBus.on('afterSaveEvent', async (obj) => {
  const savedRecordId = obj.payload.recordId;
});

afterSaveAndGetUiActionsEvent


The event occurs after a form is saved and when UI-actions are returned.

Return:

TypeDescription
Object

This method returns a form object.

{
  "payload": {
    "view": "Default",
    "tableName": "task",
    "recordId": "166307559406494736",
    "displayValue": ""
  },
  "result": "OK"
}

or an error.

{
  "payload": {
    "errors": [...]
  },
  "result": "ERROR"
}

Example:

on
SimpleEventBus.on('afterSaveAndGetUiActionsEvent', async (obj) => {
  const savedRecordId = obj.payload.recordId; 
});

afterValidation


The event occurs after the widget field validation. It is used in combination with the validation event.

Return:

TypeDescription
Boolean

The event returns a boolean value (true or false).

{
  name: 'active',
  isValid: true,
}

Example:

on
SimpleEventBus.on('afterValidation', async (obj) => {
  if (obj.name === 'active' && obj.isValid) {
    // do something
  }
});

validation


The event calls the validation of fields. 

Return:

TypeDescription
List of fieldsThe event returns the list of fields.

Example:

on
SimpleEventBus.emit('validation', fields);

  • No labels

8 Comments

  1. { view: 'default', tableName: 'task', recordId: '1000000001', displayValue: 'Test Task', result: 'OK',}
    Ой, тут ошибочка. Я направильно написал.
    { payload: {view: 'default', tableName: 'task', recordId: '1000000001', displayValue: 'Test Task',}, result: 'OK',}

  2. { errors: ['Text error'], result: 'ERROR',}
    Тут тоже
    { payload: {errors: ['Text error'],}, result: 'ERROR',}

  3. { view: 'default', tableName: 'task', recordId: '1000000001', displayValue: 'Test Task', result: 'OK',}
    Тут тоже с payload
  4. { errors: ['Text error'], result: 'ERROR',}
    Тут тоже с payload
  5. SimpleEventBus.on('afterSaveAndGetUiActionsEvent', async (obj) => { });

    SimpleEventBus.on('afterSaveAndGetUiActionsEvent', async (obj) => {
      const savedRecordId = obj.payload.recordId;
    });

  6. SimpleEventBus.on('afterLoadBreadcrumbs', async (obj) => { });

    SimpleEventBus.on('afterLoadBreadcrumbs', async (obj) => {
       const backUrl = obj.previousNode.url;

       ...
    });

  7. SimpleEventBus.on('afterValidation', async (obj) => { });

    SimpleEventBus.on('afterLoadBreadcrumbs', async (obj) => {
       if (obj.name === 'active' && obj.isValid) {

        ...

    }
    });

  8. SimpleEventBus.on('afterLoadWidgets', async (obj) => { });

    SimpleEventBus.on('afterLoadWidgets', async (isLoading) => {
       if (isLoading) {

         ...

         // do something

    }
    });