Using iTop

Creating your iTop

iTop Customization

"How to" examples

User Interface

Automation & Ticket management

Portal Customization

:: Version 3.2.0 ::

Force a field to be mandatory in User Portal

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

Force a field to be filled in User portal
XML, Constrain, Portal
min version:

This use case is just one way of forcing a field to be provided.

This method can force a field to be provided in the Portal ONLY. It has no effect on all other creation/modification means.

In this use case, we will describe how we have forced service_id and servicesubcategory_id to be mandatory on a UserRequest, when it is created in the User Portal. As you can see in the Console, those 2 fields aren't mandatory at UserRequets creation, because they are not mandatory in the Datamodel and they are not mandatory within the lifecycle before state 'Resolved'.

The User Portal is described in XML and you can change the behavior and the look & feel of a form below the form tag. Check reference for exhaustive possibilities.

itop_design / module_designs
<module_design id="itop-portal">
  <form id="ticket-create">
    <!-- It's not possible to modify part of a twig without redefining it completely -->
    <twig _delta="redefine">
      <div class="row">
        <div class="col-sm-6">
          <!-- data-field-flags can force a field to be mandatory, read_only, hidden -->
          <!-- or even to be modified (must_change). -->
          <!-- "mandatory,must_change" forces the field to be changed for a non-empty value -->
          <div class="form_field" data-field-id="service_id" data-field-flags="mandatory"></div>
        <div class="col-sm-6">
          <div class="form_field" data-field-id="servicesubcategory_id" data-field-flags="mandatory">
      <!-- [Rest of the XML tags for the twig...] -->

To remove the mandatory flag, redefine the twig with the existing XML in which you remove data-field-flags=“mandatory”.

Corner case: if a field is:

Then the Portal engine will ignore those form flags and will add the field as mandatory at the end of the form.

3_2_0/customization/mandatory-in-portal.txt · Last modified: 2024/06/20 17:28 (external edit)
Back to top
Contact us