It's all about the answers!

Ask a question

How can I determine if a workitem parent was set or changed?


David Weber (7621810) | asked Feb 19 '09, 5:08 p.m.
In a Follow-up action for 'Work Item Save (server)', how can I determine if the workitem being saved just had its parent set or changed in this save operation?

I see a ISaveParameter::getNewReferences() method where I can find the 'new' parent, but there is no corresponding 'getOldReferences()'.

Is there a technique I can use to get the 'old' parent?

Thanks in advance,

Dave

4 answers



permanent link
Patrick Streule (4.9k21) | answered Feb 23 '09, 10:18 a.m.
JAZZ DEVELOPER
In a Follow-up action for 'Work Item Save (server)', how can I
determine if the workitem being saved just had its parent set or
changed in this save operation?

I see a ISaveParameter::getNewReferences() method where I can find the
'new' parent, but there is no corresponding 'getOldReferences()'.

Is there a technique I can use to get the 'old' parent?

You could try to cast to WorkItemReferences. There are methods to get the
deleted and created references:

WorkItemReferences references= (WorkItemReferences)
saveParameter.getNewReferences();
doSomethingWith(references.getDeletedReferences());
doSomethingElseWith(references.getCreatedReferences());

--
Regards,
Patrick
Jazz Work Item Team

permanent link
David Weber (7621810) | answered Feb 24 '09, 5:40 p.m.
Thanks for the reply. This technique worked.

However, I get 'Discouraged Access' warnings from the compiler making calls to WorkItemReferences.

Can these methods be added to IWorkItemReferences?

Thanks,

Dave

permanent link
Patrick Streule (4.9k21) | answered Feb 26 '09, 10:18 a.m.
JAZZ DEVELOPER
Thanks for the reply. This technique worked.

However, I get 'Discouraged Access' warnings from the compiler making
calls to WorkItemReferences.

Can these methods be added to IWorkItemReferences?

I think that would make sense. Please see
https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/72536

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Nate Decker (37814761) | answered Jul 11 '14, 12:01 p.m.
I needed to use this technique as well and it works for detecting created references, but doesn't appear to work for detected deleted references. Is the strategy described above supposed to work for that case? If so, I may have an implementation issue. If it's not possible, I'd appreciate a heads up so I don't waste too much time trying...

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.