use the search for word subtask.
How do I update a parent field when subtask field changes?
I'm needing to set the value of a single-select field that is shared/same between a parent and subtask.
When the field value of the subtask changes, I would like to populate the same field on the parent with the same value of the subtask.
Is there a way a TeamScript can identify the associated parent of a subtask AND set the parent's field value when that same field changes in the subtask? Any ideas?
4 Answers
Thank you Nikolay. I assume there is documentation in the TeamScript manual that refers to this "Search" function/feature you're suggesting.
the idea of changing fields in your case should consists on:
teamscript call after notification rule "subtask item change" triggers on field change in subtask or master item.
also you can refer this example http://www.cmcrossroads.com/forums?func=view&id=47155&catid=70
I did something similar in which comments added to a subtask were copied back to the parent.
You need a field on the subtask that holds the id of the parent.
sub copyCommentsToParent(item, table_id)
dim t_comment, p_comment, parent_id, parent, ok
ok = item.getFieldValue("Comments", t_comment)
ok = item.getFieldValue("Parent", parent_id)
if (parent_id <> 0) then
set parent = ext.createProjectBasedRecord(table_id)
ok = parent.read(parent_id)
ok = parent.getFieldValue("Comments", p_comment)
ok = parent.setFieldValue("Comments", t_comment & vbcrlf & vbcrlf & p_comment)
ok = parent.updatewithlock(true)
end if
end sub