Separate Prefixes for Requests, Incidents, and Problems
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).
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.
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'.
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:
- 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.