You are browsing the documentation for iTop 3.0 which is not the current version.

Consider browsing to iTop 3.2 documentation

Force a field to be always mandatory

Prerequisite: You must be familiar with the Syntax used in Tutorials

learning:
Force a field to be always filled
level:
Beginner
domains:
XML, Constrain
min version:
2.1.0

Goal

In this first use case related to forcing a field to be provided.
Here we want the “location” to be filled on all PhysicalDevices, all the time, so on all sub-classes: Servers, Mobile Phones, Rack, Tablet, PDU,… and so on.

with the Designer

Prerequisite: You must be a Combodo's customer


with an iTop Extension

Prerequisite: You must have already created an iTop extension.

As the field location_id is declared directly on the class PhysicalDevice, we just set the tag is_null_allowed to false on the field.

itop_design / classes
  <class id="PhysicalDevice">
    <fields>
      <field id="location_id">
        <is_null_allowed _delta="redefine">false</is_null_allowed>
      </field>
    </fields>
  </class>

Migration: At Setup (or the Toolkit), if some existing PhysicalDevice in iTop do not have a Location documented, You will get an error message. Later in iTop, with menu DB tools, you can rerun that same check. You can fix the objects in iTop, as this error won't prevent their opening and modification. If you have DataSynchro or REST/JSON script completing invalid PhysicalDevice on field other than Location, it will fail, so it's better to fix them.

is_null_allowed flag will force the field to be provided in all cases: on the Console, in the Portal, in CSV import, in DataSynchro and in REST/JSON API
3_0_0/customization/mandatory-field-always.txt · Last modified: 2023/03/03 15:08 by 127.0.0.1
Back to top
Contact us