Hi,
I try create parallel workflow task via spell.
The problem is that when I add tasks via spell to the change order all newly added tasks are with status "WAIT", instead of the first task wil get status "PENDING" and all the other status WAIT:
This is my code:
Trigger:
OBJECT chg {
TRIGGERS {
POST_VALIDATE z_add_chg_wf ( ) 100 FILTER (EVENT("INSERT"));
};
};
SPL:
chg::z_add_chg_wf(...)
{
object group_leader, new_wf;
//group leader
send_wait(0, top_object(), "get_co_group");
if (msg_error()) {
logf(ERROR, format("Error in get_co_group: %s", msg[0]));
return;
}
group_leader = msg[0];
//create new first task
send_wait( 0, top_object(), "call_attr", "wf", "get_new_dob", NULL, NULL, group_leader);
if (msg_error())
{
logf(ERROR, format("Error in get_new_dob: %s", msg[0]));
return;
}
new_wf = msg[0];
//Set the values for new work flow
new_wf.object_type = "chg";
new_wf.chg = id;
new_wf.task = "GRPSTART";
new_wf.sequence = 10;
//create new task
send_wait( 0, top_object(), "call_attr", "wf", "get_new_dob", NULL, NULL, group_leader);
if (msg_error())
{
logf(ERROR, format("Error in get_new_dob: %s", msg[0]));
return;
}
new_wf = msg[0];
//Set the values for new work flow
new_wf.object_type = "chg";
new_wf.chg = id;
new_wf.task = "WORK";
new_wf.sequence = 20;
//create new task
send_wait( 0, top_object(), "call_attr", "wf", "get_new_dob", NULL, NULL, group_leader);
if (msg_error())
{
logf(ERROR, format("Error in get_new_dob: %s", msg[0]));
return;
}
new_wf = msg[0];
//Set the values for new work flow
new_wf.object_type = "chg";
new_wf.chg = id;
new_wf.task = "WORK";
new_wf.sequence = 30;
//create new task
send_wait( 0, top_object(), "call_attr", "wf", "get_new_dob", NULL, NULL, group_leader);
if (msg_error())
{
logf(ERROR, format("Error in get_new_dob: %s", msg[0]));
return;
}
new_wf = msg[0];
//Set the values for new work flow
new_wf.object_type = "chg";
new_wf.chg = id;
new_wf.task = "GRPEND";
new_wf.sequence = 40;
//Checkin wf object
send_wait(0, group_leader, "checkin");
if (msg_error())
{
logf(ERROR, format("Error checkin error '%s'", msg[0]));
send_wait(0, group_leader, "uncheck");
}
}
What did I do wrong in the code?