CA Service Management

 View Only
  • 1.  Change Request Status when WF Task Completed

    Posted Oct 03, 2018 01:25 PM

    We have a requirement to update the status of a request to Closed when a workflow task is completed. I have tried to implement the changes in the following community post, but I unfortunately cannot get it to work.

    https://communities.ca.com/thread/241755510

     

    The issue that I am having is getting the correct action macro code, to change the status of the parent request. I have tried all the solutions below, and I get similar errors that were found in the last comment by user avi_m in the post above.

     

    cr.status = 'appropriate status code';

    misc::change_ticket_status(this.cr, group_leader, attached_event, event_tmpl, ''appropriate status code");

     

    I am not sure if there is a spl code file that may need to accompany the macro or not.

     

    Note: I am currently using version 14.1



  • 2.  Re: Change Request Status when WF Task Completed

    Broadcom Employee
    Posted Oct 03, 2018 03:20 PM

    Please let guys know which part does not work...like can't load the macro, can define the action right etc



  • 3.  Re: Change Request Status when WF Task Completed

    Broadcom Employee
    Posted Oct 04, 2018 11:03 AM

    A separate thought from the above instructions given:  why not use maileater?  One can send a mail that is triggered at the final workflow task which maileater processes to update the CO to close.



  • 4.  Re: Change Request Status when WF Task Completed
    Best Answer

    Posted Oct 04, 2018 12:02 PM

    I have found a solution:

    I created an Action Macro called "Status Change" and added the following code found from https://communities.ca.com/thread/241789191-action-macro-in-classic-workflow-to-set-group-in-request-tickets, but modified it to change the parent requests status instead of the group.

     

    object cr_dob;
    send_wait(0, this, "call_attr",  "cr", "get_dob");
    if (msg_error())
    {
    logf(ERROR, format("unable to retrieve cr associated to wf"));
    return;
    }
    cr_dob= msg[0];
    if(!is_null(cr_dob))
    {
    send_wait(0, top_object(), "get_co_group");
    if (msg_error()){
    logf(ERROR, "get_group_leader () failed: %s", msg[0]);
    return;
    }
    object gl;
    gl = msg[0];
    send_wait(0, gl, "checkout", cr_dob);
    if (msg_error())
    {
    logf(ERROR, "Error checking out dob, error: %s", msg[0]);
    return;
    }
    cr_dob.status=status;
    send_wait(0, gl, "checkin");
    }

     

    I then attached the macro to the workflow task as a behavior, on our specified status that will complete the flow, I attached the 'Status Change' macro as an action on true.