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);
}
}