It's all about the answers!

Ask a question

How to access Attributes of Workitems


Sarthak Sharma (4711520) | asked Jun 28 '12, 4:25 a.m.
retagged Jun 28 '12, 4:44 a.m. by Arne Bister (2.6k12632)
I am coding a plugin , in which I need to set the attributes of a work item.
If I have IWorkItem instance available and the attribute ID as well
then,
How Can I do that ?

Accepted answer


permanent link
sam detweiler (12.4k6177201) | answered Jun 28 '12, 8:14 a.m.
1. an Advisor cannot change attributes.. but a Participant can
2. you must get the WorkingCopy of the IWorkitem object, otherwise it is read only
3. there are methods on IWorkitem to set the builtin attributes, for example
    setPriority(Identifier<IPriority> value)
          Sets the priority to the given identifier.

    and setValue(IAttribute attribute, java.lang.Object value)
          Sets the value of the given attribute.
for all the rest (custom attributes)

Sam


Sarthak Sharma selected this answer as the correct answer

One other answer



permanent link
Muthukumar C (32712733) | answered Jun 29 '12, 12:49 a.m.
Sam,

I disagree with the point 1.

Actually the rule is that "You should not write code in Operation Advisors to modify a field of a Work item". It does'nt mean that it won't work if you use setvalue method in Operation Advisor..

I have tested the setvalue method in the Operation Advisor itslef [Server Side] and it is working fine.

Regards
Muthukumar.C

Your answer


Register or to post your answer.