Difference between revisions of "Set Priority Based on Urgency and Impact"

From SDU
Jump to: navigation, search
m (Reverted edits by Agegeleruvy (Talk); changed back to last version by Harry.pieterse@glidepath.n)
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://awuhodynaro.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
 
----
 
=[http://awuhodynaro.co.cc CLICK HERE]=
 
----
 
</div>
 
 
__NOTOC__
 
__NOTOC__
 
[[Category:Customizations]]
 
[[Category:Customizations]]
Line 24: Line 16:
 
=== Step 1. Create the script ===
 
=== Step 1. 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).
 
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).
&lt;source lang=&quot;javascript&quot;&gt;cr::zmyscript(...){
+
<source lang="javascript">cr::zmyscript(...){
 
int z_pri;
 
int z_pri;
         if ((urgency == 0) &amp;&amp; (impact == 5))  
+
         if ((urgency == 0) && (impact == 5))  
 
             {z_pri = 5;}
 
             {z_pri = 5;}
 
         // priority = 4, is priority of High
 
         // priority = 4, is priority of High
         if (((urgency == 0) &amp;&amp; (impact == 4)) ||
+
         if (((urgency == 0) && (impact == 4)) ||
             ((urgency == 0) &amp;&amp; (impact == 3)) ||
+
             ((urgency == 0) && (impact == 3)) ||
             ((urgency == 1) &amp;&amp; (impact == 5)) ||
+
             ((urgency == 1) && (impact == 5)) ||
             ((urgency == 1) &amp;&amp; (impact == 4)) ||
+
             ((urgency == 1) && (impact == 4)) ||
             ((urgency == 2) &amp;&amp; (impact == 5)))
+
             ((urgency == 2) && (impact == 5)))
 
             {z_pri = 4;}
 
             {z_pri = 4;}
 
         // priority =3, is priority of Medium
 
         // priority =3, is priority of Medium
         if (((urgency == 0) &amp;&amp; (impact == 2)) ||
+
         if (((urgency == 0) && (impact == 2)) ||
             ((urgency == 1) &amp;&amp; (impact == 3)) ||
+
             ((urgency == 1) && (impact == 3)) ||
             ((urgency == 1) &amp;&amp; (impact == 2)) ||
+
             ((urgency == 1) && (impact == 2)) ||
             ((urgency == 2) &amp;&amp; (impact == 4)) ||
+
             ((urgency == 2) && (impact == 4)) ||
             ((urgency == 2) &amp;&amp; (impact == 3)) ||
+
             ((urgency == 2) && (impact == 3)) ||
             ((urgency == 3) &amp;&amp; (impact == 5)) ||
+
             ((urgency == 3) && (impact == 5)) ||
             ((urgency == 3) &amp;&amp; (impact == 4)))
+
             ((urgency == 3) && (impact == 4)))
 
             {z_pri = 3;}
 
             {z_pri = 3;}
 
         // priority = 2, is priority of Low
 
         // priority = 2, is priority of Low
         if (((urgency == 2) &amp;&amp; (impact == 2)) ||
+
         if (((urgency == 2) && (impact == 2)) ||
             ((urgency == 3) &amp;&amp; (impact == 3)) ||
+
             ((urgency == 3) && (impact == 3)) ||
             ((urgency == 3) &amp;&amp; (impact == 2)))
+
             ((urgency == 3) && (impact == 2)))
 
             {z_pri = 2;}
 
             {z_pri = 2;}
  send_wait(0, this, &quot;call_attr&quot;, &quot;priority&quot;, &quot;set_val&quot;, z_pri, &quot;SURE_SET&quot;);
+
  send_wait(0, this, "call_attr", "priority", "set_val", z_pri, "SURE_SET");
 
if (msg_error()) {
 
if (msg_error()) {
logf(ERROR, &quot;error setting priority to %s on %s %s - %s&quot;, z_pri, type.sym, ref_num, msg[0]);
+
logf(ERROR, "error setting priority to %s on %s %s - %s", z_pri, type.sym, ref_num, msg[0]);
 
return;
 
return;
 
} else {
 
} else {
logf(SIGNIFICANT, &quot;successfully set priority to %s on %s %s&quot;, z_pri, type.sym, ref_num);
+
logf(SIGNIFICANT, "successfully set priority to %s on %s %s", z_pri, type.sym, ref_num);
 
}
 
}
}&lt;/source&gt;
+
}</source>
 
This script was based on the following matrix:
 
This script was based on the following matrix:
 
{|
 
{|
Line 68: Line 60:
 
|-
 
|-
 
! 1-Critical
 
! 1-Critical
| bgcolor=&quot;red&quot;|Critical
+
| bgcolor="red"|Critical
| bgcolor=&quot;yellow&quot;|High
+
| bgcolor="yellow"|High
| bgcolor=&quot;yellow&quot;|High
+
| bgcolor="yellow"|High
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
 
|-  
 
|-  
 
! 2-High
 
! 2-High
| bgcolor=&quot;yellow&quot;|High
+
| bgcolor="yellow"|High
| bgcolor=&quot;yellow&quot;|High
+
| bgcolor="yellow"|High
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
 
|-  
 
|-  
 
! 3-Medium
 
! 3-Medium
| bgcolor=&quot;yellow&quot;|High
+
| bgcolor="yellow"|High
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
| bgcolor=&quot;blue&quot;|Low
+
| bgcolor="blue"|Low
 
|-
 
|-
 
! 4-Low
 
! 4-Low
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
| bgcolor=&quot;green&quot;|Medium
+
| bgcolor="green"|Medium
| bgcolor=&quot;blue&quot;|Low
+
| bgcolor="blue"|Low
| bgcolor=&quot;blue&quot;|Low
+
| bgcolor="blue"|Low
 
|-
 
|-
 
|}
 
|}
Line 97: Line 89:
  
 
''For r11.x releases'' triggers are created via the [[Schema Designer]] utility. Simply add the following code as a [[Site-Defined Trigger]] to the '''[[Call Req Table|cr (Request)]]''' table.
 
''For r11.x releases'' triggers are created via the [[Schema Designer]] utility. Simply add the following code as a [[Site-Defined Trigger]] to the '''[[Call Req Table|cr (Request)]]''' table.
  POST_VALIDATE zprefix() 111 FILTER(EVENT(&quot;INSERT&quot;) || (impact{} || urgency{}));
+
  POST_VALIDATE zprefix() 111 FILTER(EVENT("INSERT") || (impact{} || urgency{}));
  
 
''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 file|.mod]] anything you like, but it is recommended that it be preceded with a 'z'.
 
''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 file|.mod]] anything you like, but it is recommended that it be preceded with a 'z'.
&lt;source lang=&quot;javascript&quot;&gt;OBJECT cr {
+
<source lang="javascript">OBJECT cr {
 
   TRIGGERS {
 
   TRIGGERS {
     POST_VALIDATE zmyscript() 111 FILTER(EVENT(&quot;INSERT&quot;) || (impact{} || urgency{}));
+
     POST_VALIDATE zmyscript() 111 FILTER(EVENT("INSERT") || (impact{} || urgency{}));
 
   };
 
   };
};&lt;/source&gt;
+
};</source>
  
 
=== Step 3. Publish the Schema changes ===
 
=== Step 3. Publish the Schema changes ===

Revision as of 05:27, 30 November 2010

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This article provides instructions for setting a ticket's priority field based on the values of it's urgency and impact fields.

Procedures

Step 1. 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">cr::zmyscript(...){ int z_pri;

       if ((urgency == 0) && (impact == 5)) 
           {z_pri = 5;}
       // priority = 4, is priority of High
       if (((urgency == 0) && (impact == 4)) ||
           ((urgency == 0) && (impact == 3)) ||
           ((urgency == 1) && (impact == 5)) ||
           ((urgency == 1) && (impact == 4)) ||
           ((urgency == 2) && (impact == 5)))
           {z_pri = 4;}
       // priority =3, is priority of Medium
       if (((urgency == 0) && (impact == 2)) ||
           ((urgency == 1) && (impact == 3)) ||
           ((urgency == 1) && (impact == 2)) ||
           ((urgency == 2) && (impact == 4)) ||
           ((urgency == 2) && (impact == 3)) ||
           ((urgency == 3) && (impact == 5)) ||
           ((urgency == 3) && (impact == 4)))
           {z_pri = 3;}
       // priority = 2, is priority of Low
       if (((urgency == 2) && (impact == 2)) ||
           ((urgency == 3) && (impact == 3)) ||
           ((urgency == 3) && (impact == 2)))
           {z_pri = 2;}
	send_wait(0, this, "call_attr", "priority", "set_val", z_pri, "SURE_SET");

if (msg_error()) { logf(ERROR, "error setting priority to %s on %s %s - %s", z_pri, type.sym, ref_num, msg[0]); return; } else { logf(SIGNIFICANT, "successfully set priority to %s on %s %s", z_pri, type.sym, ref_num); } }</source> This script was based on the following matrix:

Priority Matrix
1-Critical 2-High 3-Medium 4-Low
1-Critical Critical High High Medium
2-High High High Medium Medium
3-Medium High Medium Medium Low
4-Low Medium Medium Low Low

Step 2. 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) table.

POST_VALIDATE zprefix() 111 FILTER(EVENT("INSERT") || (impact{} || urgency{}));

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">OBJECT cr {

 TRIGGERS {
   POST_VALIDATE zmyscript() 111 FILTER(EVENT("INSERT") || (impact{} || urgency{}));
 };

};</source>

Step 3. 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. Publish Schema changes
  3. Stop the Service Desk service
  4. Run pdm_publish from a command line
  5. Start the Service Desk service

For older release recycle the Service Desk service.