Sidebar

Using iTop

Creating your iTop

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

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

Consider browsing to iTop 3.2 documentation

Consolidated status

Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.
We also assume that you are familiar with dashboard design within iTop and OQL.

learning:
Define a status on FunctionalCI to allow easy search and filter of CI based on **CI status**
level:
Beginner
domains:
XML, Attribute
min version:
2.3.0

Within the Ticket class you have an aggregated status, using a special type of Attribute, called AttributeMetaEnum.
It is automatically computed based on sub-ticket class field values, with a mapping logic.

You can mirror that logic and created a new AttributeMetaEnum field on the FunctionalCI class, which is computed based on fields defined below on one or multiple sub-classes.

If you have added some values to the enum status of some sub-classes of FunctionalCI, such as for example in_stock, you may want to either

  • add a new value on the meta enum operational_status
  • or just a new mapping as otherwise, by default, status='in_stock' will appear with a operation_status value of production instead of maybe implementation

Add a computed status

itop-design / classes
    <class id="FunctionalCI" _created_in="itop-config-mgmt" _delta="must_exist">
      <fields>
        <field id="operational_status" xsi:type="AttributeMetaEnum" _delta="define">
          <values>
            <value id="production"><code>production</ code></value>
            <value id="implementation"><code>implementation</ code></value>
            <value id="obsolete"><code>obsolete</ code></value>
          </values>
          <sql>operational_status</sql>
          <default_value>production</default_value>  <!--If no mapping applies, this value is used-->
          <mappings>  <!--define how to compute on the fly the AttributeMetaEnum based on values of other field defined below on child class-->
            <mapping id="FunctionalCI">  <!--ID must be the current class or a child class-->
              <attcode>status</attcode>  <!--this is expected to be a attribute code of at least one child class-->
              <metavalues>
                <metavalue id="implementation">
                  <values>
                    <value id="implementation"/>
                  </values>
                </metavalue>
                <metavalue id="obsolete"> <!--This is the value of the AttributeMetaEnum-->
                  <values>
                    <value id="obsolete"/>  <!--This are the values of the <attcode> defined in the mapping-->
                    <value id="inactive"/>
                  </values>
                </metavalue>
              </metavalues>
            </mapping>  <!--You can define multiple mappings, first matching one is used to define the AttributeMetaEnum value-->
          </mappings>
        </field>
   </fields>
</class>

Modify a computed status

In this example, we would like

  • to define a new escalated value for the Ticket Operational status, with its mapping
  • change the mapping for a different logic
    • the rejected status of a UserRequest should be reported as an on-going Ticket,
    • while the rejected status of a Change should remained as a closed Ticket
itop-design / classes / class@Ticket / fields
<field id="operational_status" xsi:type="AttributeMetaEnum">
        <values _delta="must_exist">
                <value id="escalated" _delta="define">
                        <code>escalated</ code>  //Remove the blank on the closing tag after copy-paste !!!! It's due to dokuwiki tag collision
                </value>
        </values>
        <mappings>
                <mapping id="Ticket" _delta="must_exist">
                        <metavalues>
                                <metavalue id="escalated" _delta="define">
                                        <values>
                                                <value id="escalated_tto"/>
                                                <value id="escalated_ttr"/>
                                        </values>
                                </metavalue>
                                <metavalue id="closed" _delta="must_exist">
                                        <values>
                                                <value id="rejected" _delta="delete"/> // remove the global mapping for the 'rejected' value
                                        </values>
                                </metavalue>
                        </metavalues>                  
                </mapping>
                <mapping id="Change" _delta="define">  // Define a mapping rule only for the Change
                        <attcode>status</attcode>
                        <metavalues>
                                <metavalue id="closed">
                                        <values>
                                                <value id="closed"/> // Not sure that this is needed as the Ticket mapping should apply
                                                <value id="rejected"/> // Only the Change 'rejected' value is mapped to 'closed' MetaEnum value
                                        </values>
                                </metavalue>
                        </metavalues>                  
                </mapping>  // There is no need to create a mapping with id="UserRequest"
        </mappings>         // for mapping the 'rejected' value with 'ongoing' MetaEnum value as it's the default
</field>
3_1_0/customization/meta-enum.txt ยท Last modified: 2024/05/30 11:35 (external edit)
Back to top
Contact us