Force a field to be always mandatory
Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.
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
- 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_allowedflag 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