Difference between revisions of "Set Request/Incident/Problem Status from Change Order"
m (→Step 4. Edit the request_status_change.htmpl form) |
m (Set Request, Incident and Problem Status from Change Order moved to Set Request/Incident/Problem Status from Change Order: conforming with standard naming) |
||
| (11 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
| + | [[Category:Change Orders]] | ||
[[Category:Customizations]] | [[Category:Customizations]] | ||
| + | [[Category:Incidents]] | ||
| + | [[Category:Problems]] | ||
| + | [[Category:Requests]] | ||
| + | [[Category:r11]] | ||
| + | [[Category:Schema Changes]] | ||
| + | [[Category:Spel Code]] | ||
{{Global Header}} | {{Global Header}} | ||
{{Global Announcement}} | {{Global Announcement}} | ||
| Line 21: | Line 28: | ||
{{Create Spell Script}} | {{Create Spell Script}} | ||
| − | <source lang="javascript">chgalg:: | + | <source lang="javascript">chgalg::zstat_to_cr(...){ |
if (!is_null(zcr_stat)) { | if (!is_null(zcr_stat)) { | ||
string chg_num, cr_desc, cr_num, cr_origstatsym, cr_stat, cr_statsym, cr_type, wc; | string chg_num, cr_desc, cr_num, cr_origstatsym, cr_stat, cr_statsym, cr_type, wc; | ||
| Line 57: | Line 64: | ||
} | } | ||
} | } | ||
| − | |||
} | } | ||
| − | |||
} | } | ||
}</source> | }</source> | ||
| Line 65: | Line 70: | ||
=== Step 2. Create the trigger === | === Step 2. Create the trigger === | ||
This step is to create the trigger that will initiate the script. Use the [[Schema Designer]] utility to add the following code as a [[Site-Defined Trigger]] to the '''[[Change Act Log Table|chgalg (Change Activity Log)]]''' table. | This step is to create the trigger that will initiate the script. Use the [[Schema Designer]] utility to add the following code as a [[Site-Defined Trigger]] to the '''[[Change Act Log Table|chgalg (Change Activity Log)]]''' table. | ||
| − | <source lang="javascript">POST_VALIDATE | + | <source lang="javascript">POST_VALIDATE zstat_to_cr() 113 FILTER(type{-> 'CNCL'} || type{-> 'ST'} || type{-> 'CL'});</source> |
This trigger will activate when the Cancel (CNCL), Update Status (ST), or Closed (CL) Activities are initiated. | This trigger will activate when the Cancel (CNCL), Update Status (ST), or Closed (CL) Activities are initiated. | ||
| Line 74: | Line 79: | ||
ATTRIBUTES Change_Act_Log { | ATTRIBUTES Change_Act_Log { | ||
zcr_stat LOCAL SREL crs; | zcr_stat LOCAL SREL crs; | ||
| − | };</source> | + | }; |
| + | };</source> | ||
=== Step 4. Edit the order_status_change.htmpl form === | === Step 4. Edit the order_status_change.htmpl form === | ||
| Line 87: | Line 93: | ||
=== Step 5. Publish the Schema changes === | === Step 5. Publish the Schema changes === | ||
{{R11 Publish Schema Change}} | {{R11 Publish Schema Change}} | ||
| + | |||
| + | |||
| + | == See Also == | ||
| + | [[Propagate Status to Children]] | ||
Latest revision as of 16:20, 7 December 2008
To discuss or ask questions about this article, select the discussion tab above.
Overview
This article provides instructions for being able to set the Status of all Request, Incident, and Problem tickets when setting the Status of a Change Order.
This customization was designed for the r11.x releases, and is untested in older releases.
Benefits
- When setting the Status of a Change Order, the Status of all attached Requests, Incidents and Problems can be set.
- The Request/Incident/Problem Activity Logs are annotated with syntax stating that the Status change was initiated by from the Change Order.
- Users have an option per Status Update whether or not to set the Status of the attached Request, Incident and Problem Tickets.
Known Issues
The Status of a Request/Incident/Problem cannot be updated if there are any requirements not yet fulfilled. For example, if RootCause is required on Resolve, then the Status will fail to update on the ticket that needs a RootCause, but will update all the other tickets that have fulfilled their requirements. No alert is provided when a ticket fails to be update.
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">chgalg::zstat_to_cr(...){ if (!is_null(zcr_stat)) { string chg_num, cr_desc, cr_num, cr_origstatsym, cr_stat, cr_statsym, cr_type, wc; object cr_dob, cr_list, group_leader; int cr_count, i; uuid login_userid;
chg_num = change_id.chg_ref_num; cr_stat = zcr_stat; cr_statsym = zcr_stat.sym; wc = format("change = %s AND active = 1 AND status != 'RE'", change_id);
send_wait(0, top_object(), "call_attr", "chg", "current_user_id"); login_userid = msg[0]; send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "STATIC", wc, -1,0); cr_count = msg[1]; cr_list = msg[0]; if (cr_count > 0) { for(i=0;i< cr_count;i++) { send_wait(0, cr_list, "dob_by_index", "DEFAULT", i, i); cr_dob = msg[0]; send_wait(0, cr_dob, "get_attr_vals",3,"ref_num","type.sym","status.sym"); cr_num = msg[3]; cr_type = msg[6]; cr_origstatsym = msg[9]; cr_desc = "Status changed from \'" + cr_origstatsym + "\' to \'" + cr_statsym + "\' (initiated from Change Order " + chg_num + ")" ; send_wait(0, top_object(), "get_co_group"); group_leader = msg[0]; send_wait(0, cr_dob, "change_status", group_leader, login_userid, cr_desc, cr_stat, NULL); send_wait(0, group_leader, 'checkin'); if (msg_error()) { logf(ERROR, "error changing status to '%s' on %s %s from Change %s - %s", cr_statsym, cr_type, cr_num, chg_num, msg[0]); } else { logf(SIGNIFICANT, "successfully set status to '%s' on %s %s from Change %s", cr_statsym, cr_type, cr_num, chg_num); } } } } }</source>
Step 2. Create the trigger
This step is to create the trigger that will initiate the script. Use the Schema Designer utility to add the following code as a Site-Defined Trigger to the chgalg (Change Activity Log) table. <source lang="javascript">POST_VALIDATE zstat_to_cr() 113 FILTER(type{-> 'CNCL'} || type{-> 'ST'} || type{-> 'CL'});</source> This trigger will activate when the Cancel (CNCL), Update Status (ST), or Closed (CL) Activities are initiated.
Step 3. Add field to Object Engine
This step creates a field that exists only in the Object Engine which means it doesn't have a dedicated field in the database. Make this change 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'. The Web Screen Painter cannot be used for making Object Engine fields. Implementing this field adds the ability to select the desired Status for the attached Requests, Incidents, and Problems on an as needed basis.
<source lang="text">OBJECT chgalg {
ATTRIBUTES Change_Act_Log {
zcr_stat LOCAL SREL crs;
};
};</source>
Step 4. Edit the order_status_change.htmpl form
This step will add a dropdown giving the option to set the Status for all the attached Request, Incident, and Problem tickets. Add the following code:<source lang="html4strict"><PDM_IF $args.cr_list.length > 0 > <PDM_MACRO NAME=dtlDropdown hdr="New Req/Inc/Prb Status" attr=chgalg.zcr_stat lookup=no> </PDM_IF></source>
Note: The <PDM_IF> prevents the dropdown from appearing if there are no attached Requests, Incidents, and Problems. Other conditions can be added to the <PDM_IF> if this capability should have more restricted use.
Step 5. Publish the Schema changes
Follow these steps for publishing the schema changes:
- Save and Publish your Schema changes
- Stop the Service Desk service
- Run pdm_publish from a command line
- Start the Service Desk service