Separate Prefixes for Requests, Incidents, and Problems

From SDU
Revision as of 04:46, 13 January 2008 by Gityerfix (Talk | contribs) (Step 2. Create the trigger)

Jump to: navigation, search

This article provides instructions for having system generated Activities set to Internal so it cannot be viewed by users of the Employee or Customer Interfaces.

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

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

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.

CODE
POST_VALIDATE zprefix() 113 FILTER(EVENT("INSERT"));

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

CODE
MODIFY cr POST_VALIDATE zprefix() 113 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.