Hello David,
Actually I have a condition macro when the status of the change order pass from "Abierto" to "Aprobacion en Progreso"
This is the code of the condition macro
string wheretask;
object wf_list, wf;
wheretask=format("id=%d AND chgtype = 200",this.id);
send_wait(0, top_object(), "call_attr", "chg", "sync_fetch", "STATIC", wheretask, -1, 0);
if (msg_error())
{
logf(ERROR, "Error determinando el tipo del cambio: %s", msg[0]);
set_return_data(FALSE);
return;
}
else
{
int count;
object obList;
count = msg[1];
obList = msg[0];
if(count<=0)
{
logf(SIGNIFICANT, "Orden de Cambio: %s no es de tipo Normal", this.chg_ref_num);
set_return_data(TRUE);
return;
}
else
{
logf(SIGNIFICANT, "Orden de Cambio: %s es de tipo Normal", this.chg_ref_num);
wheretask=format("chg=%d AND ((status = 'PEND' or status = 'WAIT' or status = 'WF-APENP' ) or assignee is NULL)",this.id);
send_wait(0, top_object(), "call_attr", "wf", "sync_fetch", "STATIC", wheretask, -1, 0);
if (msg_error())
{
logf(ERROR, "Error buscando tareas de workflow: %s", msg[0]);
set_return_data(FALSE);
return;
}
else
{
count = msg[1];
obList = msg[0];
logf(SIGNIFICANT, "Orden de Cambio: %s Transicion invalidada a estado Aprobacion en progreso tareas sin asignado: %s", this.chg_ref_num, msg[1]);
if(count>0)
{
set_return_data(FALSE);
return;
}
else
{
set_return_data(TRUE);
return;
}
}
}
}
then if the condition is true the change order pass to "Aprobacion en Progreso" and a evento is execute....
the event execute an action macro to change the assigned and group.
I want to do this using a button. It is possible or does not have any sense?