A. SETUP
1. Create a new macro, defined as follows:
Symbol: karenAlwaysTrue
Object Type: Change Order Workflow Task
Macro Type: Site-defined Condition
Macro Description: always return true
If all Conditions succeed return: TRUE
Record Status: Active
Macro Code (automatically generated): set_return_data(TRUE);
2. Create a new macro, defined as follows:
Symbol: set WF status to SKIP
Record Status: Active
Macro Description: To set the status of the WF task to skip
Object Type: Change Order Workflow Task
Macro Type: Action
Lock Object: Yes
Macro Type Description: spell code to execute for an action
Macro Code: send_wait(0, this, "call_attr", "status", "set_val", "SKIP", "INTERP");
For example, to create that action macro, since it cannot be done from the web interface,
2.a. Create a file named "test1.txt" containing:
TABLE Spell_Macro
del description fragment id last_mod_by last_mod_dt lock_object msg_html msg_tmpl_info ob_type persid sym tenant type usr_integer1 usr_integer2 usr_integer3 usr_string2 usr_string3 usr_string4
{ "0" ,"To set the status of the WF task to skip", "send_wait(0, this, \"call_attr\", \"status\", \"set_val\", \"SKIP\", \"INTERP\");", "" ,"" ,"" ,"1" ,"" ,"" ,"wf" ,"" ,"set WF status to SKIP", "" ,"ACT" ,"" ,"" ,"" ,"" ,"" ,"" }
2.b. Run:
pdm_load -i -f test1.txt
3. For the Change Order category named "Move.IT" :
3.a. Create classic workflow tasks with Seq and Task as follows:
10 Approval
20 Approval
30 Approval
40 Group Start Task
50 Approval
60 Approval
70 Approval
80 Approval
90 Approval
100 Approval
110 Group End Task
120 Approval
130 Approval
3.b. For each of the above tasks except 40 GRPSTART and 110 GRPEND, add the behavior named "Skip".
3.c. For sequence 50 through 100, edit the "Pending" behavior and add the Condition created in step #1 named "karenAlwaysTrue" and set the "Actions on True Macro List" to the Action Macro created in step#2 named "set WF status to SKIP".
4. Create a file named "macroapp2.frg" with the following content and place it in $NX_ROOT\site:
update_wf(int wf_pid) {
object wf_obj,gl;
send_wait(0, top_object(), "get_co_group");
gl=msg[0];
printf("starting update_wf function\n");
send_wait(0, top_object(), "call_attr", "wf", "sync_fetch", "STATIC", format("id=%d",wf_pid), -1, 0);
if (msg_error()) {
printf("%s: can't get wf by persid\n", wf_pid);
}
// check count
count = msg[1];
if( count == 0 ) {
printf("Unable toget wf\n");
}
// get wf
send_wait(0, msg[0], "dob_by_index", "DEFAULT", 0, 0);
wf_obj = msg[0];
send_wait(0,gl,"checkout",wf_obj);
send_wait(0, wf_obj, "call_attr", "status", "set_val", "APP");
if (msg_error()) {
printf("%s: can't update wf by persid\n", msg[0]);
}
send_wait(0,gl,"checkin");
}
B. OPERATIONS
5. Create a change order and set the Category to "Move.IT". Note the change order number, nn.
6. Run:
pdm_extract -f "select persid from Change Request where chg_ref_num='nn' "
Note the result is of the form chg:yyyyyy where yyyyyy is an integer.
7. Using the SDM web interface, open the change order, view the workflow task list, edit seq 10 and set the status from Pending to Approve; edit seq 20 and set the status from Pending to Approve.
8. Using the value of yyyyyy from step #6 in place of yyyyyy, run:
pdm_extract -f "select persid from Workflow_Task where sequence=30 and object_type='chg' and object_id=yyyyyyy "
Note the result is of the form wf:xxxxxx where xxxxxx is an integer.
9. Use the integer value in the persid from step#8 to replace xxxxxx, run "nxcd site", and then run:
bop_cmd -n -d domsrvr -u servicedesk -f macroapp2.frg "update_wf(xxxxxx)"
C. ERROR RESULTS
10.a. The Group End Task remains at Wait, it never completes.
10.b. The change of status of tasks 50-100 to Skip are not all recorded in the Change Order Activity Log List.
Release : 17.X
Component : Service Desk Manager - Workflow
The root cause is not yet known.
Important Note: Due to the use of custom macros (these cannot be created via the web interface), this solution is unsupported and being presented as a possible resolution not a guaranteed resolution.
In the frg file named macroapp2.frg (or equivalent), change:
send_wait(0, wf_obj, "call_attr", "status", "set_val", "APP");
to:
send_wait(0, wf_obj, "call_attr", "status", "set_val", "APP", "SURE_SET");