CA Service Management

Expand all | Collapse all

Action Macro in Classic Workflow to set Group in Request Tickets

Jump to Best Answer
  • 1.  Action Macro in Classic Workflow to set Group in Request Tickets

    Posted 01-16-2018 09:40 AM

    Hi guys,

     

    I'm using CA SDM 14.1.04 and I've this scenario:

     

    How can I create a action macro to transfer one request ticket to specified group when the classic workflow task is completed?

    I'm using the following status on classic Workflow task: Pending, Approved and Rejected.

    When the status is approved, the ticket request must be filled with a group "XYZ".

     

    How can I do this?

     

    Thanks in advance guys.

    Cya.



  • 2.  Re: Action Macro in Classic Workflow to set Group in Request Tickets

    Posted 01-16-2018 11:50 AM

    Hello,

     

    Just to clarify, are you asking to have the given Request that is hosting the Workflow transfer its group ownership over?  Wanted to make sure it's not a scenario where a given Workflow is going to affect another Request entirely, and not the Request that the Workflow resides under.

     

    My feeling, off the top of my head, is that you would need to do a Transition when the Workflow completes to reassign the given Request.



  • 3.  Re: Action Macro in Classic Workflow to set Group in Request Tickets

    Posted 01-16-2018 12:21 PM

    Hi David,

     

    Thanks for the response.

    The workflow task is attached to a ticket request.

     

    When this task change the status to Approved, I need the parent ticket request change for a specified group.



  • 4.  Re: Action Macro in Classic Workflow to set Group in Request Tickets

     
    Posted 01-16-2018 11:13 PM

    You can do this by creating a 'behavior' for the task for the status 'Approved' in the workflow template.  In your case the behavior needs to call a macro that attaches an event to the CR, for which it can call a function similar to 'misc::site_att_cr_evt_byid' below.  Change 'logf(SIGNIFICANT' to 'logf(TRACE' below (or #define ZDEBUG as 0) once you have the functionality working, to save cluttering 'stdlog'.

    The event that you attach will be a Request/Incident/Problem event that calls a transfer macro, such as 'transfer to event group' which takes the new group from the 'Text' field on the event.

    #define ZDEBUG 99
    //
    //  Pass 'SLA' as event_group_id to attach a Service Type event.  For a non-Service Type event,
    //  pass some other label such as 'zzz'.

    //
    void misc::site_att_cr_evt_byid( string event_sym, int cr_id, int delay_sec, string event_group_id )
    {
       string method;
       method = "misc::site_att_cr_evt_byid";

       if ( ZDEBUG > 0 ) logf(SIGNIFICANT, "%s: Started ", method);
       //check symbol of event
       int evt_id;
       evt_id = (int)expand(format("&{'%s' = evt.sym->id}", event_sym));

       if ( is_null(evt_id) || (evt_id == 0) )
       {
          logf(ERROR, "%s: Symbol of event  '%s' is not recognized.", method, event_sym);
          return;
       }

       if ( ZDEBUG > 0 ) logf(SIGNIFICANT, "%s: Event sym '%s' verified, attaching with delay %d...", method, event_sym, delay_sec);

       send_wait(0, top_object(), "call_attr", "evt", "new_attached_event", (object)NULL,
                 format("cr:%d",cr_id), event_sym, (duration) delay_sec,
                 (date) NULL, event_group_id, 0, 0, "GMT+0800 (2)");
      // Change the timezone in the 'send_wait' call to your local TZ!
       if (msg_error())
       {
          logf(ERROR, "%s: error returned by new_attached_event: %s", method, (string)msg[0]);
          return;
       }

       if ( ZDEBUG > 0 )
       {
          logf(SIGNIFICANT, "%s: Attach event called ", method);
          object attevt;
          attevt = msg[0];
          send_wait(0, attevt, "call_attr", "id", "get_val");
          int attevt_id;
          attevt_id = msg[0];
          logf(SIGNIFICANT, "%s: Finished. Attached event id = %d", method, attevt_id);
       }
    }

    Regards,

    James



  • 5.  Re: Action Macro in Classic Workflow to set Group in Request Tickets

    Posted 01-22-2018 09:50 AM

    Thiago..........

     

    Did the information provided by James help you out?

     

    If so, please mark his answer as correct so that this thread can be closed.



  • 6.  Re: Action Macro in Classic Workflow to set Group in Request Tickets
    Best Answer

    Posted 01-22-2018 10:33 AM

    Hi guys, I've used this solution, it's more easier to transfer que parent ticket to a specific group:

     

     

    send_wait(0, top_object(), "call_attr", "api", "update_object_super", last_mod_by, cr.persistent_id, 0, "group", (uuid)"D1ED28F606E8DF409B383D08FA12D578");