Add "New Record" support to a combo box

We would like to support the following use case:

  • User is entering data
  • Then looking up something in a combo-box drop down list
  • Then doesn’t find the desired record
  • Then is allowed to create the record using a modal dialog
  • Then continues working on data entry

Set Up

The functionality should be set up by modelling a new lookup binding element and optionally a specific data entry screen.

Model Changes

A New Record Screen Binding model element should be created under a a lookup similar to a menu binding.

This should contain the following properties:

  • Roles
  • Menu
  • DialogWidth
  • DialogHeight

UI Changes

When a new record binding exists for the current user (by evaluating Roles) the combo box should display a new button left to the drop down arrow. By clicking on this button a modal dialog is opened. Alternatively if filtering in the dropdown results in zero results a Add new… should be presented as the only drop down item.

The process of opening the screen

  • It should not load any data
  • It should switch the root entity section to detail view and disable (+) and (-) buttons. This would allow reusing the standard data entry screens e.g. for simple one-field lists.
  • It should add a new record automatically to the master entity (screens with multiple root entities should not be allowed by model consistency check).
  • Potential action buttons should show as usual in the bottom of the modal dialog as standard buttons (we already do this in modal dialogs)
  • Save and Cancel buttons should show

The process of leaving the screen

  • After clicking on Save the SAVE action should be called on the server like with a standard data screens.
  • All standard situations for saving should work (executing a validation rule before saving, handling exceptions after saving, e.g. displaying rule exceptions)
  • The modal dialog should close
  • An id of a record from the root entity should be selected in the combo-box
  • Clicking on Cancel should simply close the screen without selecting anything in the combo-box

Mobile version

Everything should be standard and should work by the current responsive design rules (e.g. modal dialogs).

Modelling notes

If the combo-box is filtered so adding a new record would require a specific value pre-filled, this can be handled using a default-set in the menu item specified in the binding. This way when a new record is added in the modal dialog it would also contain the right values.

What if a user enters a duplicate master data value in the entering dialog? I assume it will throw an error from the db (unique index failure). The entering dialog should handle the case and allow entering a different value or allow closing so that user can close the existing value.

At least, the use case should be tested.

That should be handled by properly handling the Save button. So when an exception occurs, no data would be saved (like with a standard screen) and the user can correct the input and try again. Or he can press Cancel without saving.

Branch add-record-in-combo-box


The mobile version of the new feature was not implemented yet. A new ticket has been created for it instead: