CA Service Management

Expand all | Collapse all

Set status as pending approval if selected category has approval work flow tasks

Jump to Best Answer
  • 1.  Set status as pending approval if selected category has approval work flow tasks

    Posted 09-25-2017 05:35 AM

    We want to set ticket status to pending for approval

    if selected category has approval work flow tasks



  • 2.  Re: Set status as pending approval if selected category has approval work flow tasks

    Posted 09-25-2017 08:02 AM

    Hi Manjunatha,

    You would need to set up some custom conditions with action macros such that if a ticket has active approval wf tasks on it, then the status is automatically updated to "Pending for Approval"  - however, this would have to be an event that fires on every ticket to check for that and act based upon it.  Outside of that, the only way to do this would be to have some type of custom javascript code that verifies there are active tasks upon saving a ticket and sets the status on that ticket based on that.

    Unfortunately out of the box, I dont believe there is anything available to directly tie ticket status to the tasks on that ticket.

    Can anyone else out here think of a creative way to do this?

    Jon



  • 3.  Re: Set status as pending approval if selected category has approval work flow tasks

    Posted 09-25-2017 11:55 AM

    Are you using classic workflow or Process Automation?



  • 4.  Re: Set status as pending approval if selected category has approval work flow tasks

    Posted 10-03-2017 03:07 AM

    Hi lindsay we are using  classic workflow



  • 5.  Re: Set status as pending approval if selected category has approval work flow tasks

     
    Posted 10-03-2017 03:42 AM

    My first thought would be to add a first task to every category workflow - which I think of as a 'gatekeeper' task - which would have a 'behavior' that causes it to complete itself on going Pending and launches the change status update through a macro.

    Hope that helps :-)

    Regards,

    James



  • 6.  Re: Set status as pending approval if selected category has approval work flow tasks
    Best Answer

    Posted 10-03-2017 11:49 AM

    You can add  trigger on category change, then write the spel code that will look for approval task

    e.g.

    chg::check_app(...)

    {

    send_wait(0,top_object(),"call_attr","wf","sync_fetch","MLIST_STATIC", format("task = 'APP' AND chg = %s", id),-1,0);
       if (msg_error()) {
        logf(ERROR, "Error in get_list_values for slatpl '%s'", msg[0]);
        return;
       } 
       app_count = msg[1];

    if (app_count > 0)

    {

    uuid who;
     send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
     who=msg[0];

    send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persistent_id, 0, "status", "chgstat:400001"); 
        if (msg_error()) {
        logf(ERROR, "Error setting est_completion_date: '%s'", msg[0]);
        return;

    }

    }

     

    Few notes:

    You may need to use POST_CI trigger to ensure workflow is allready there. In this case you will need to pass change id and persistent_id as parameter to your spel code

    You will need change chgstat:400001



  • 7.  Re: Set status as pending approval if selected category has approval work flow tasks

    Posted 10-04-2017 09:31 AM

    Hi Manjunatha, 

    Does Giedrius' reply give you the info you needed on this one? If so, can you please mark his reply as correct?

    Thanks,

    Jon I.