Propagate Status to Children

From SDU
Jump to: navigation, search
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 being able to set the Status of all child tickets when setting the Status of the parent.

This customization was designed for the r11.x releases, and is untested in older releases.

Benefits

  • All Statuses can be passed from Parent to Children.
  • The Child Activity Logs are annotated with syntax stating that the Status change was initiated by the Parent.
  • The "Close All Children" option found in the Actions Menu is obsolete.
  • Users have an option per Status update whether to propagate to the Children or not.

Known Issues

The Status of a Child 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 Children needing a RootCause, but will update all the other Children that have fulfilled their requirements. No alert is provided when Children fail 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">alg::zstat_to_child(...) { string c_desc, c_num, c_origstatsym, c_type, p_num, p_stat, p_statsym, p_type, wc; object c_dob, c_list, group_leader; int c_count, i; uuid login_userid;

p_num = call_req_id.ref_num; p_stat = call_req_id.status; p_statsym = call_req_id.status.sym; p_type = call_req_id.type.sym; wc = format("parent = '%s' AND status != '%s' AND status != 'RE' AND status != 'CL'", call_req_id, p_stat);

send_wait(0, top_object(), "call_attr", "cr", "current_user_id"); login_userid = msg[0]; send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "MLIST_STATIC", wc, -1,0); c_count = msg[1]; c_list = msg[0]; if (c_count > 0) { for(i=0;i< c_count;i++) { send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i); c_dob = msg[0]; send_wait(0, c_dob, "get_attr_vals",3,"ref_num","type.sym","status.sym"); c_num = msg[3]; c_type = msg[6]; c_origstatsym = msg[9]; if (description == action_desc) { c_desc = "Status changed from \'" + c_origstatsym + "\' to \'" + p_statsym + "\'" ; } else { c_desc = description; } c_desc = c_desc + " (initiated from Parent " + p_type + " " + p_num + ")" ; send_wait(0, top_object(), "get_co_group"); group_leader = msg[0]; send_wait(0, c_dob, "change_status", group_leader, login_userid, c_desc, p_stat, NULL); send_wait(0, group_leader, 'checkin'); if (msg_error()) { logf(ERROR, "error changing status to '%s' on Child %s %s from Parent %s %s - %s", p_statsym, c_type, c_num, p_type, p_num, msg[0]); } else { logf(SIGNIFICANT, "successfully set status to '%s' on Child %s %s from Parent %s %s", p_statsym, c_type, c_num, p_type, p_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 alg (Request Activity Log) table. <source lang="javascript">POST_VALIDATE zstat_to_child() 111 FILTER((type{-> 'RE'} || type{-> 'ST'} || type{-> 'CL'}) && zset_child_f == 1);</source> This trigger will activate when the Resolved (RE), 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 an option to allow someone to determine if the Status should be propagated from Parent to Children on an as needed basis.

<source lang="text">OBJECT alg {

 ATTRIBUTES Act_Log {
   zset_child_f	LOCAL	INTEGER { ON_DB_INIT SET 0 ; } ;
 };

};</source> Note: If the Propagate Solution to Children customization is implemented there is no need to add the zset_child_f field.

Step 4. Edit the request_status_change.htmpl form

r11.x Screenshot - Propagate to Children?

This step will add a checkbox giving the option to propagate the Status to children. Add the following code:<source lang="javascript"><PDM_IF $args.children.length > 0 > <PDM_MACRO NAME=dtlCheckbox hdr="Propagate to Children?" attr=alg.zset_child_f> </PDM_IF></source>

Note: The <PDM_IF> prevents the checkbox from appearing if there are no children. 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:

  1. Save and Publish your Schema changes
  2. Stop the Service Desk service
  3. Run pdm_publish from a command line
  4. Start the Service Desk service

See Also

Propagate Solution to Children
Set Request/Incident/Problem Status from Change Order