TMACUL

http://www.servicedeskusers.com/Count_Ticket_Reopens

Blog Post created by TMACUL Champion on Jan 1, 2016

Overview

This article provides instructions for calculating the number of times a ticket is reopened.

Procedures

Step 1. Create new field

The methods used to create new tables columns vary based on the Service Desk release.

r11.x Screenshot - Add Column

 

r11.x Screenshot - Add Column

For r11.x releases, follow these steps:

  1. Launch the Web Screen Painter then the Schema Designer
  2. Add a column per the image to the right.
  3. Save and Publish your Schema changes
  4. Stop the Service Desk service
  5. Run pdm_publish from a command line
  6. Start the Service Desk service

style="color:rgb(0, 0, 0);font-family:'Times New Roman';font-size:medium"

  • Stop the Service Desk service
  • Start the Service Desk service

For older release recycle the Service Desk service.

 

1. Create a .sch file with the following syntax and place it in the $NX_ROOT/site/mods directory. Name the .sch anything you like, but it is recommended that it be preceded with a 'z'.

// Use TABLE Call_Req for Requests, Incidents & Problems

// Use TABLE Change_Request for Change Orders

// Use TABLE Issue for Issues

TABLE Call_Req {

  zreopen_count INTEGER;

}

 

2. Create a .mod file with the following syntax and place it in the $NX_ROOT/site/mods/majic directory. Name the .mod anything you like, but it is recommended that it be preceded with a 'z'.

 

 

/ Use OBJECT cr and ATTRIBUTE Call_Req for Requests, Incidents & Problems

// Use OBJECT chg and ATTRIBUTE Change_Request for Change Orders

// Use OBJECT iss and ATTRIBUTE Issue for Issues

OBJECT cr {

  ATTRIBUTES Call_Req {

  zreopen_count INTEGER

   {

  ON_NEW DEFAULT "0";

   };

   };

};

 

 

3. Run a pdm_extract command of the target table. Example:

pdm_extract Call_Req > Call_Req.txt

4. Run the Configuration Utility and do not start the Service Desk services.

5. Run a build command of the target table. Example:

sqlbuild -p Call_Req AHD "C:\Program Files\CA\Unicenter ServicePlus Service Desk\site\ddict.sch"

6. Start the Service Desk services

7. Run a pdm_load command of the previously extracted data. Example:

pdm_load -f Call_Req.txt -v

Step 2. Create the script

A script is created as an .spl file and placed in the $NX_ROOT/site/mods/majic directory. When the Service Desk service starts, the contents of the majic directory are processed and cached. You can use any naming scheme you like for your .spl file, but it is recommended that the file be preceded with a 'z' for easy identification as a custom file (eg zMyCompany.spl, zcr_scripts.spl, zMyScripts.spl).

 

// Use 'cr' for Requests, Incidents & Problems, 'chg' for Changes, and 'iss' for Issues

cr::zmyscript(...) {

int i, n;

if (is_null(zreopen_count)) {

i = 0;

} else {

i = zreopen_count;

}

n = i + 1;

send_wait(0, this, "call_attr", "zreopen_count", "set_val", n, "SURE_SET");

}

 

Step 3. Create the trigger

This step is to create the trigger that will initiate the script. The methods used to implement the trigger vary based on the Service Desk release.

For r11.x releases triggers are created via the Schema Designer utility. Simply add the following code as a Site-Defined Trigger to the cr (Request), chg (Change Order), or iss (Issue) table.

PRE_VALIDATE zmyscript() 111 FILTER(active{->1}); 

For older releases triggers are made by creating a .mod file and placing it in the $NX_ROOT/site/mods/majic directory. Name the .mod anything you like, but it is recommended that it be preceded with a 'z'.

 

// Use OBJECT cr for Requests, Incidents & Problems

// Use OBJECT chg for Change Orders

// Use OBJECT iss for Issues

OBJECT cr {

  TRIGGERS {

  POST_VALIDATE zmyscript() 111 FILTER(active{->1});

  };

};

 

Step 4. Publish the Schema changes

The methods used to publish schema changes vary based on the Service Desk release.

For r11.x releases, follow these steps:

  1. Save your Schema changes
  2. Stop the Service Desk service
  3. Run pdm_publish from a command line
  4. Start the Service Desk service

For older release recycle the Service Desk service.

Outcomes