Ability to set defaultNewRecord via routing data

Bug #1989348 reported by Julian Clementson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Wishlist
Unassigned

Bug Description

Within the eg2 staff admin components, where we are using BasicAdminPageComponent, with fields automatically populated from the data definition, we are not able to set default values for fields on a new record. In order to do that, we need to create a custom component as a copy of BasicAdminPageComponent, resulting in code duplication.

This is a proposal to be able to set the default values for a new record via routing data, the same way as done for fieldOrder and readonlyFields.

I propose that we implement support for a defaultNewRecord object in routing modules as follows (this example taken from a need identified in bug 1842297):

{
    path: 'config/openathens_identity',
    component: BasicAdminPageComponent,
    data: [{
        schema: 'config',
        table: 'openathens_identity',
        fieldOrder: 'id,org_unit,active,api_key,...',
        defaultNewRecord: { active: true, auto_signon_enabled: true, unique_identifier: 1, display_name: 1 }
    }],
}

Tags: pullrequest
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Julian Clementson (oajulianc) wrote :
tags: added: pullrequest
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Confirmed that the test passes, and that I can use the new defaultNewRecord option to add some defaults to an fm-editor. Thanks for this contribution, Julian; seems very useful. Merged!

Changed in evergreen:
milestone: none → 3.10-beta
importance: Undecided → Wishlist
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.