BPM结束任务
var pi = tw.system.findProcessInstanceByID("158");
for(var i=0; i<pi.tasks.length; i++) {
var subjectPrefix = pi.tasks[i].subject.indexOf("承办", 0);
if(subjectPrefix==0 && pi.tasks[i].status=="Received" ) {
pi.tasks[i].reassignTo(tw.system.user);
pi.tasks[i].complete(tw.system.user, new tw.object.Map());
}
}