Using iTop

Creating your iTop

iTop Customization

"How to" examples

User Interface

Automation & Ticket management

Portal Customization

:: Version 3.2.0 ::

Close Ticket automatically after a delay

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

Close Ticket automatically after a delay
XML, PHP, Lifecycle
min version:

Let's assume we want to automatically close Ticket which are in frozen state for more than 21 days

What do we need to do for this:

  1. Add a Stopwatch with threshold(s) and goal
  2. Write the Computing method
  3. Define Trigger and Notifications on your iTop instance, if you want to notify the customer before automatically closing the ticket
  4. Restart the counter from scratch if the customer replies and the ticket exits the frozen state.

Add Stopwatch

  1. Add a Stopwatch field on the UserRequest class
  2. Define the states during which the Stopwatch will be running
  3. Considering that the Delay of 21 days does not need to care about neither business hours nor week-ends & vacations, we use 24*7 coverage window, which is the default. Its code is DefaultWorkingTimeComputer.
  4. Define threshold(s), here I defined three so I can use them later in trigger and notifications.
  5. On 100% Threshold, which is when the goal is reached, I force the UserRequest to close it-self, which will stop the stopwatch as the UserRequest will no more be in a state where the stopwatch is running.
  6. Set a goal

Put this in a file of your extension

classes / class@UserRequest / fields
        <field id="pending_customer_stopwatch" xsi:type="AttributeStopWatch" _delta="define">
            <state id="frozen">frozen</state>
            <threshold id="33">
            <threshold id="66">
            <threshold id="100">
                    <param xsi:type="string">ev_resolve</param>

Computing method

Put this in a of your extension

  class ComputePendingDelay implements iMetricComputer
    public static function GetDescription()
            return "Used to compute delay when pending caller";
    public function ComputeMetric($oObject)
        // Set the delay as a configuration parameter if you wish or hardcode it.
        $iDelay = MetaModel::GetModuleSetting('itop-request-mgmt', 'pending_delay', '21'); 
        $iRes = $iDelay*86400;  // $iDelay in days * 86400 seconds within one day
        return $iRes;

Define Notifications

With the above example you can create Trigger (on threshold) and action when the User Request reach 33%, 66% or 100% of the goal. This means you can have different email content at different level of the threshold.

Restart the counter

On any transition exiting the frozen state, you may want to reset the counter.

classes / class@UserRequest / lifecycle / states
          <state id="frozen" _delta="define">
              <!-- more transitions -->
              <transition id="ev_autoresolve">
                      <param xsi:type="attcode">pending_customer_stopwatch</param>
                  <!-- more actions -->
3_2_0/customization/auto-close.txt ยท Last modified: 2024/06/20 17:28 (external edit)
Back to top
Contact us