CA Service Management

  • 1.  Classic Workflow Group Task

    Posted Mar 11, 2016 03:36 AM

    Hi all,

     

    Is it possible for grouped approval tasks to cancel if one of the approval tasks is rejected?

     

    For example:

    1     Group start task

    2     Approval

    3     Approval

    4     Group end task

     

    If the task#2 is rejected then task#3 will be canceled/skipped, and vise versa.

     

    Best regards,

    Conan



  • 2.  Re: Classic Workflow Group Task

    Posted Mar 11, 2016 05:40 AM

    Unfortunately this is not possible out of the box.

    Task under a group are independent.

    To archive that you will need to create spl code for an action macro as usual this is not supported by CA

    This code will have to retrieve  the corresponding task for this CO and this particular group in the WF and change their status individually  using a loop.

    Hope this help

    /J



  • 3.  Re: Classic Workflow Group Task

    Posted Mar 11, 2016 01:31 PM

    My experience with this is if you put the 2 Approval tasks first, before the 'Group Start' task, and your approval task has the 'Set CHG Status Cancelled' macro set on the 'Actions on True Macro List' of the 'Reject' status, then this is what happens:

     

    • When the first approval step is approved, then the second approval moves to 'pending'.  When the second approval step is approved, the other tasks move to 'pending'.
    • When the first approval step is rejected, then the CO and other tasks all get cancelled.
    • When the first approval step is approved, but the second one is rejected, then the CO and other tasks all get cancelled.

     

    Isn't this what you're looking to do?

     

    Tammy



  • 4.  Re: Classic Workflow Group Task

    Posted Mar 14, 2016 03:03 AM

    Hi Tammy,

     

    Thanks for the reply, but this is not what I am looking for.

    The requirement needs those tasks to start at the same time, hence using the group tasks.

     

    Best regards,

    Conan



  • 5.  Re: Classic Workflow Group Task

    Posted Mar 14, 2016 05:05 AM

    You will need to do some coding to achieve this effect, it cannot be 'configured'



  • 6.  Re: Classic Workflow Group Task

    Posted Mar 14, 2016 05:08 AM

    Hi Conan,

    this could be achieved in this way:

    1. as I remember workflow's have 2 OOTB statuses: Reject and Cancel (system used for cancelled change orders), you need to create new status like "Approval revoked" and add it to workflow behaviour;
    2. hide that status from dropdown in detail_wf form;
    3. check behaviours for your workflow tasks, they should have at least 3 kind of selections:
      • positive (like Approved);
      • negative (like Rejected);
      • and for spel purpose kind of custom cancellation (like Approval revoked);
    4. add Action macro to Reject behaviour for each workflow you want to trigger cancellation.

     

    You can build your own macro with fetching and updating data, or you can use this method SPEL: Object update

    If you will use my method, code will be short and look like:

    macro::upd_val("wf", 
      format("task = 'APP' AND chg = %d AND status = 'PEND' AND id != %d", chg, id), // replace APP with your decied task code
      3, 
      15, 
      "status", 
      "APP_RVK"); // spel used custom workflow status for cancelled workflow
    

     

    Hope this helps.

     

    Regards,

    cdtj



  • 7.  Re: Classic Workflow Group Task
    Best Answer

    Posted Mar 14, 2016 06:07 AM

    Hi cdtj,

     

    Thanks for the reply.

    I don't quite understand the your solution.

     

    But I end up using a solution of yours about a year ago.

    This Macro will reset the change category to null, which will remove all tasks with wait status, then use delete_wc to delete all pending tasks.

    object chg_dob;
    send_wait(0, this, "call_attr", "chg", "get_dob");
    chg_dob= msg[0];
    send_wait(0, top_object(), "get_co_group");
    object gl;
    gl = msg[0];
    send_wait(0, gl, "checkout", chg_dob);
    chg_dob.category="";
    send_wait(0, gl, "checkin");
    string z_factory, z_where_clause;
    z_factory = "wf";
    z_where_clause = format("chg=%d and status='PEND'",chg.id);
    send_wait(0, top_object(), "call_attr", "api", "delete_wc", z_factory, z_where_clause, NULL);
    

     

    On the side note, how do you hide the specific status on detail_wf?

    This is the OOTB detail_wf source code.

    detailRowHdr("Status", 1 , "$args.REQUIRED_status");
    var item = '<PDM_SELECT NAME=SET.status ESC_STYLE=HTML FACTORY=tskstat WF_FAC_FOR_TSKSTAT=wf SELECTED="$args.status" SELECTED_SYM="$args.status.COMMON_NAME" TITLE="' + _dtl.lastHdrtext + '">';
    var ins_pos = item.indexOf("NAME=");
    if (ins_pos > 0) 
    {
        _dtl.tabIndex++;
        item = item.substring(0, ins_pos) + " TABINDEX=" + _dtl.tabIndex + " " + item.substring(ins_pos, item.length);
    }
    detailSetRowData(item);
    

     

    The only way I can think of:

    <PDM_IF "$args.task.code" == "APP">
    <PDM_MACRO name=dtlDropdown hdr="Status" attr="status" lookup="no" whereclause="code='APP' or code='REJ'">
    </PDM_IF>
    

    Anyway I can modify the OOTB source code to hide specific status base on task type?

     

    Best regards,

    Conan



  • 8.  Re: Classic Workflow Group Task

    Posted Mar 14, 2016 07:07 AM

    Deleting isn't good way, because attached events could be still active and trigger some notifications to missed workflows, here is 2 ways:

    • return to status cancellation, to hide status you need to replace it with empty string via js.

    Insert after: item = item.substring(0, ins_pos) + " TABINDEX=" + _dtl.tabIndex + " " + item.substring(ins_pos, item.length);

    item=item.replace(/<OPTION VALUE="APP_RVK">Approval Revoked/g, "");
    • other way is to manually cancel attached event, for this purposes you can use cancel_me method : SPEL EVENT methods


  • 9.  Re: Classic Workflow Group Task

    Posted Mar 14, 2016 07:39 AM

    Completely agree with you cdtj, people often forgot about dependency like events when working on object rsulting over the time to unstable system.

    /J