Force a field to be always mandatory
Prerequisite: You must be familiar with the Syntax used in Tutorials
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
-
Open the class PhysicalDevice
-
Edit field location_id
-
In the pop-up check the Mandatory checkbox.
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