Sorry for necroposing
I have figured how to insert workflow task using general method, here is the code:
void grpWf(...) {
logf(SIGNIFICANT, ">> insert wf start");
object gl, wfobj, chg, prevwf, wftpl, new1, new2;
int i, msg_i;
send_wait(0, top_object(), "call_attr", "wf", "dob_by_persid", 0, "wf:1174756");
prevwf = msg[0];
send_wait(0, top_object(), "call_attr", "wftpl", "dob_by_persid", 0, "wftpl:427324");
wftpl = msg[0];
send_wait(0, top_object(), "call_attr", "chg", "dob_by_persid", 0, "chg:496215");
chg = msg[0];
send_wait(0, top_object(), "get_co_group");
if (msg_error()) {
for (i=0;i<msg_length();i++) {
logf(ERROR, "msg[%d]: %s", i, msg[i]);
}
}
gl = msg[0];
send_wait(0, top_object(), "call_attr", "wf", "add_workflow_task",
gl,
chg,
"PEND",
(uuid)NULL,
(uuid)prevwf.creator,
(string)"TST_EXTR_APP",
(object)wftpl,
(uuid)prevwf.assignee,
(duration)NULL,
(int)NULL,
(date)NULL,
(int)0,
(int)0,
(int)(prevwf.sequence + 10)
);
if (msg_error()) {
for (i=0;i<msg_length();i++) {
logf(ERROR, "msg[%d]: %s", i, (string)msg[i]);
}
return;
} else {
for (i=0;i<msg_length();i++) {
logf(SIGNIFICANT, "msg[%d]: %s", i, (string)msg[i]);
}
}
new1 = msg[0];
new2 = msg[1];
send_wait(0, new1, "call_attr", "comments", "set_val", "Created via SPL", "SURE_SET");
send_wait(0, new1, "call_attr", "group", "set_val", prevwf.group, "SURE_SET");
send_wait(0, new2, "call_attr", "description", "set_val", format("%s\nCreated via SPL", new2.description), "SURE_SET");
send_wait(0, gl, "checkin");
if (msg_error()) {
for (i=0;i<msg_length();i++) {
logf(ERROR, "msg[%d]: %s", i, msg[i]);
}
send_wait(0, gl, "uncheck");
}
logf(SIGNIFICANT, "<< insert wf end");
}
The only way you need to use it, is possibility to create multiple workflows in a single iteration (checkin) and possibility to control Change Activity Log.
Regards,
cdtj