UI Events: General Information

You may need to handle UI events if you need to implement runtime changes to the UI of an MYOB Acumatica form that are not implemented in the built-in UI functionality.

Learning Objectives

In this chapter, you will learn how to do the following:

  • Handle UI events
  • Work with data that is unrelated to any view by using event handling
  • Work with large binary data by using event handling

Applicable Scenarios

You handle UI events if you need to implement scenarios such as the following:

  • Change the CSS for a cell or row of a table on an MYOB Acumatica form
  • Pass to an MYOB Acumatica form data that is unrelated to any data view
  • Pass large binary data to an MYOB Acumatica form
  • Calculate a value that is only displayed on an MYOB Acumatica form and is not saved to the database

Event Handling

You use the handleEvent decorator to mark a handler of a runtime event for the specified view, for the specified field, or with no relation to a view or field.

The event types that are defined in the CustomEventType enum are supported.

Important: Be aware that any logic that you implement using event handlers is available only in the Modern UI forms and is not accessible through the web services or the mapping of the mobile application.

Sample Event Handlers

The source code of MYOB Acumatica provides a set of sample event handlers for the Sales Orders (SO301000) form. You can find it in the following location of any instance.

\FrontendSources\screen\src\screens\SO\SO301000\extensions\SO301000_FieldsSample.ts

To test the event handlers, you need to do the following:

  1. Uncomment the SO301000_FieldsSample interface.
  2. Uncomment the SO301000_FieldsSample class.
  3. Rebuild the code.