Separate Prefixes for Requests, Incidents, and Problems

From SDU
Revision as of 15:17, 27 January 2008 by Gityerfix (Talk | contribs)

Jump to: navigation, search

This article provides instructions for implementing a customization that will generate different prefixes for Requests, Incidents, and Problems. (eg R100, I101, P102) By default Service Desk uses the same prefix for all three ticket types.

Note: Ensure no prefixes are currently defined for Requests.

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::zprefix(...) { string i_ref, p_ref, r_ref, ztype, zref_num; send_wait( 0, this, "get_attr_vals",2,"ref_num","type"); zref_num = msg[3]; ztype = msg[6]; //Replace the I P R below if you want different prefixes i_ref = format("I%s", zref_num); p_ref = format("P%s", zref_num); r_ref = format("R%s", zref_num); if ( ztype == 'I' ) { send_wait(0, this, "call_attr", "ref_num", "set_val", i_ref, "SURE_SET"); } else if ( ztype == 'P' ) { send_wait(0, this, "call_attr", "ref_num", "set_val", p_ref, "SURE_SET"); } else if ( ztype == 'R' ) { send_wait(0, this, "call_attr", "ref_num", "set_val", r_ref, "SURE_SET"); } }</source>

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"));

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'.

MODIFY cr POST_VALIDATE zprefix() 111 FILTER(EVENT("INSERT"));


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. 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.



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.