Dynamic Field Screens#

Added in version 6.1: This feature is available as a public add-on for Znuny LTS 6.0

Dynamic Field screens is a GUI to assign Dynamic Fields to specific views. With the embedded import/export functions, it makes staging between different environments much easier.

This module can be found in the admin area:

../../_images/dynamicfield_screens.png

After you select it, an overview is shown with a list of available:

  • Views

  • Overviews

  • Dashboards

../../_images/dynamicfield_screens_overview.png

There are two ways to assign Dynamic Fields to views:

  • By View / Overview

  • By Field

Select / De-Select elements#

If you select a field you get a list of available views and three additional columns:

  • Disabled

  • Active

  • Active and required

This includes overviews, dashboard widgets and regular views.

You can assign a field to one or multiple views:

  1. Select one or more views and tick the checkbox

  2. Click “Assign selected elements to this list” on the matching column

  3. Save

OR

  1. Use drag and drop and move one view to the desired column

  2. Save

../../_images/dyanmicfield_screens_selection.gif

Import / Export#

The widget Import and export of configurations in the left menu of the dynamic field overview moves dynamic fields and their screen settings to another system, for example from a test system to production.

../../_images/dynamicfield_screens_overview_fields.png

Export#

  1. Click Export configurations.

  2. Select the field configurations and the screen configurations you want to export. The column Dynamic fields <-> Screens holds the screen settings of each field.

  3. Click Export. The download is a YAML file named Export_DynamicFields_<timestamp>.yml.

../../_images/dynamicfield_screens_export.png

Import#

  1. Choose the YAML file in the widget Import and export of configurations.

  2. Select Overwrite existing configurations to update dynamic fields that already exist. See below for what this changes.

  3. Click Import configurations.

  4. Select the field configurations and screen configurations to import and click Import.

A field whose field type does not exist on the target system, for example one that comes from an add-on that is not installed there, is listed with a hint and cannot be imported.

Fields in the file are matched to existing fields by name only. Invalid fields on the target system count as existing. Selected screen configurations are always applied, with or without the overwrite option.

Without Overwrite existing configurations, a field whose name does not exist yet is created. A field whose name already exists is skipped and stays unchanged.

With Overwrite existing configurations:

On the target system

Result

No field with that name

A new field is created at the end of the field order.

A field with the same name and field type

The field is overwritten. It keeps its ID, its stored values and its position in the field order. Label, object type and configuration come from the file.

A field with the same name and a different field type

The existing field is renamed to <Name>Old and keeps the stored values. A new, empty field is created under the original name.

Warning

The object type is overwritten without a check. If the file holds an article field and the target system has a ticket field with the same name and field type, the existing field becomes an article field and its stored ticket values no longer match. Compare the object types before importing with this option.

A file exported in the admin screen carries the validity of each field. A console export without --include-all-config-keys does not, so every field it creates or overwrites becomes valid.

If a field named <Name>Old already exists from an earlier import, a second change of field type fails and no new field is created. Rename or delete the old field first.

Console#

The same file format is used by the console commands. A file exported on the console can be imported in the admin screen and the other way round.

bin/znuny.Console.pl Admin::DynamicField::Export yaml > dynamic_fields.yml
bin/znuny.Console.pl Admin::DynamicField::Import dynamic_fields.yml

The export always contains every dynamic field and its screen settings. Add --include-internal-fields to include internal fields such as those of process management, and --include-all-config-keys to include IDs, validity and timestamps. The admin screen includes both. The import takes --overwrite-existing-configurations, which works like the checkbox in the admin screen.

Changed in version 7.5.1: The console commands use the same file format as the admin screen. A file exported on the console before 7.5.1 holds only a list of fields without screen settings and cannot be imported. Export it again.