UI Events: General Information

In the Modern UI of , you can handle UI events in frontend code to make runtime changes that aren’t possible through 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
  • Manage large binary data through event handling

Applicable Scenarios

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

  • Changing the CSS of a specific table cell or row on an MYOB Acumatica form
  • Passing to an MYOB Acumatica form data that is unrelated to any data view
  • Passing large binary data to an MYOB Acumatica form
  • Calculating 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 a specified view or field or with no relation to a view or field.

Only event types defined in the CustomEventType enum are supported.

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

Sample Event Handlers

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

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

To test the event handlers, do the following:

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