Count Ticket Reopens
This article provides instructions for calculating the number of times a ticket is reopened.
Step 1. Create new field
The methods used to create new tables columns vary based on the Service Desk release.For r11.x releases, follow these steps:
- Launch the Web Screen Painter then the Schema Designer
- Add a column per the image to the right.
- Save and Publish your Schema changes
- Stop the Service Desk service
- Run pdm_publish from a command line
- Start the Service Desk service
For older release, follow these steps:
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'. <source lang="javascript">// 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;
}</source>
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'. <source lang="javascript">// 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";
};
};
};</source> 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).
<source lang="javascript">// Use 'cr' for Requests, Incidents & Problems, 'chg' for Changes, and 'iss' for Issues cr::zmyscript(...) { string zmsg; // Enter an if statement 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");</source>
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'.
<source lang="javascript">// 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});
};
};</source>
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:
- Save your Schema changes
- Stop the Service Desk service
- Run pdm_publish from a command line
- Start the Service Desk service
For older release recycle the Service Desk service.
To discuss or ask questions about this article, select the discussion tab above.