CA Service Management

 View Only
  • 1.  Change order tasks behavior

    Posted May 25, 2017 08:49 PM

    Hi my friends,

     

    I'm testing the change module in CA SDM 14.1, mainly the behavior of the classic flow of workflow tasks.

     

    In my organization, change tasks are manually entered (button: Insert tasks) into a change request, they are not linked to change categories.

    Analysts create the tasks with the necessary information and assign to a group, this group has a person who approves or does not approve them.

     

    What I need to do is that at the end of all tasks are approved, the change order will set to a specific status.

    The action macro to set the status of the change order is ok. My difficulty is in control, whether all the tasks have been approved or not.

     

    What I thought of doing was to create an event with an action macro that set the status of the change order, and that the condition of the event is, verify if all the tasks in that respective change order have been approved, yes or no.

    If yes, the condition was accepted, and the macro will be executed. If any task is rejected, then the change order will go to another status (rejected)

    Sometimes the change order can have from 3 to 8 tasks. The amount of the tasks varies.

     

    Can I create a condition that verifies that all tasks have been approved? 

     

    Thank you so much.

    Regards.



  • 2.  Re: Change order tasks behavior

    Posted May 25, 2017 11:32 PM

    Hi, 

     

    If you can't use PAM you will need a spel function that gets fired when workflow task status is changed to Approved. You could add logic that checks to see if there are additional tasks not yet approved, and if so do nothing. But if all tasks are completed then change the CO status. 

     

    You won't be able to use an event on a change order because the conditions for the event are limited to fields directly associated to the change order. Workflow tasks have their own table/object. 



  • 3.  Re: Change order tasks behavior

    Posted May 26, 2017 05:07 AM

    Hi Grant, thanks for your explanation. 

     

    I'm not a expert creating SPEL function so can you help me with this code and the mechanics to implement on the CO?

     

    thank you so much  my friend. 



  • 4.  Re: Change order tasks behavior

    Posted May 26, 2017 12:59 PM

    Hi Thiago,

     

    It's my day off, but I can help point you in the right direction next week.  Can you provide the Name and Code for the Approval tasks that require this functionality, as well as the Workflow Status that would be set to satisfy the condition.  Change Workflow can have any number of Task Types and Statuses, I'm assuming you only need this behavior on Approval tasks.



  • 5.  Re: Change order tasks behavior

    Posted May 28, 2017 11:45 AM

    Yes, I agree, It's easier using spel but ...

     

    Is it posible in your process: to do a scoreboard for analyst follow the task when approved?



  • 6.  Re: Change order tasks behavior

    Posted May 29, 2017 12:22 PM

    Hi cdtj, would you mind sharing your solution here as well?    It looks like you responded to the same question on SDU.



  • 7.  Re: Change order tasks behavior

    Posted May 29, 2017 01:31 PM

    Sure  For the history and search opportunity

     

    here is the way I'm using to change CO's status: https://communities.ca.com/message/241972752-re-action-macro-to-skip-wf-task?commentID=241972752#comment-241972752

     

    As the tasks might be added manually, using *.spl is the only guaranteed way.

    After installing z_new_evt function, code could be:

    // FileName: z_status_change.mod
    MODIFY wf POST_VALIDATE z_status_change(status) 112000 FILTER(status{});
    // FileName: z_status_change.spl
    wf::z_status_change(...) {
        string old_val, new_val;
        int msg_i;

        old_val = argv[2];
        new_val = argv[3];

        // Compare prev and new statuses
        // If old status is Pending and new status is Complete or Approved do the action
        if (((new_val == "APP") || (new_val == "COMP")) && (old_val == "PEND")) {
            send_wait(0, top_object(), "call_attr", "wf", "sync_fetch", "MLIST_STATIC", format("chg = %d AND status IN ('WAIT', 'PEND') AND id != %d", chg.id, id), -1, 0);
            if (msg_error()) {
                // Print error details if something went wrong
                logf(ERROR, "%s > Unable to sync_fetch", persistent_id);
                for (msg_i = 0; msg_i < msg_length(); msg_i++) {
                    logf(ERROR, "\tmsg[%d]: %s", msg_i, msg[msg_i]);
                }
            }
            // Checking remaining tasks count
            if (msg[1] == 0) {
                evt::z_new_evt('CHG2APP', chg.persistent_id);
            } else {
                // Otherwise do nothing
                logf(SIGNIFICANT, "%s [%s > %s]. Tasks left: %d", persistent_id, old_val, new_val, msg[1]);
            }
        } else if ((new_val == "REJ") && (old_val == "PEND")) {
            // Be sure that event called CHG2REJ exists in your env
            evt::z_new_evt('CHG2REJ', chg.persistent_id);
        }
    }

    Dont forget to create Attached Event and link it with action macro.

     

    Regards, cdtj



  • 8.  Re: Change order tasks behavior

    Posted May 29, 2017 07:56 PM

    Awesome! Thank you for sharing.