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

Consider browsing to iTop 3.1 documentation

Force a field to be always mandatory

Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.

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

In this first use case related to forcing a field to be provided, 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.

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
2_7_0/customization/mandatory-field-always.txt · Last modified: 2020/04/15 15:23 (external edit)
Back to top
Contact us