The following sample script collects text of all messages for the current task:
String s = "";
for(Iterator it = task.getMessages().iterator(); it.hasNext();) {
String desc = it.next().getDescription();
if (desc != null) {
s += desc + "<br>";
s += "-------------------------------<br>";
}
}
return s;
The following sample script calculates a summary of the actual budget for all not-closed tasks.
public double getAbudget(Object t) {
double d = 0;
if(t.getAbudget() != null && t.getClosedate() == null)
d = t.getAbudget().doubleValue();
for(Iterator it = t.getChildren().iterator(); it.hasNext();)
d += getAbudget(it.next());
return d;
}
return getAbudget(task);
The following script lists all custom fields with values for the current task:
String s = "";
Map udfs = task.getUDFValues();
for(Iterator it = udfs.keySet().iterator(); it.hasNext();) {
Object udf = udfs.get(it.next());
s += udf.getCaption() + ":<br>";
s += udf.getValue(task) + "<br>";
}
return s;