It's all about the answers!

Ask a question

Product code and work item displayed as a single field

Vince Thyng (13722851) | asked Sep 19 '13, 7:09 p.m.
I am looking to create a field that can be included in a query that simply combines the work item and a product code as something like ABC-4789.  Is it possible to write your own custom attribute?  Alternatively it looks like I could add a string field attribute and write an Operation Participant triggered on work item save to update a field with this information.  And a third idea would be to write a javascript field validator, but that I think that may not run in all cases where a work item is created.

Any thoughts appreciated!

Accepted answer

permanent link
Eric Jodet (6.3k5104120) | answered Sep 20 '13, 1:06 a.m.
 Hello Vince,
what is the work item attribute to you want to pick ? work item number, summary, another attribute?
I understand that you want to create a custom attribute which value will be calculated,
and equal to <some_attribute> + <product_code>

If this is correct, I would use a JS provider and calculated values:

Hope it helps,

Vince Thyng selected this answer as the correct answer

Vince Thyng commented Sep 20 '13, 4:06 p.m. | edited Sep 20 '13, 4:10 p.m.

I want to use ID and either an abbreviated version of Filed Against (Category), or a value from an enumeration, or perhaps codes that I would have stored in the JS provider.

Are you aware of any work item manipulations that would not trigger the javascript to run?  If not, that seems like a good way to solve this.  I would populate a custom field with a combination of work item ID and code based on the Filed Against field.  Users would then include this custom field in their query as their preferred method of seeing ticket numbers.
For example do work item imports, command line work item creates/updates, and source code changeset delivers all run associated JS providers?

Eric Jodet commented Sep 23 '13, 2:00 a.m.


you may calculate / set the attribute's value based on a given state


One other answer

permanent link
Ralph Schoon (57.1k23642) | answered Sep 20 '13, 4:31 p.m.
JavaScript would not work as far as I can tell. See the limitations described in Lab 5. It might be possible to use a calculated value using Java see but it would have to grab the data from a string field and a work item type attribute.

Eric Jodet commented Sep 23 '13, 2:03 a.m.

 Hello Ralph,

what are the limitations you're referring to?

Ralph Schoon commented Sep 23 '13, 3:01 a.m.

Hi Eric,

I tried to summarize what says and what I experienced while creating the Process Enactment Workshop Lab 5 and other assets in  Lab5 (the first sections).

Basically there are a lot of limitations if you want to work on item type attributes in JavaScript. You can get the value and the name and it will provide with a uuid and maybe some displayable data (maybe the summary and the work item IF for a work item type attribute, so maybe you get what you want.) I am not really sure, what you'd get for a work item attribute. You can not follow links etc. JavaScript is just very limited. You can try to use it, but it might not provide what is needed. Java providers are a lot more flexible and can access a lot more data than in JavaScript.

Vince Thyng commented Sep 23 '13, 6:09 p.m. | edited Sep 23 '13, 6:09 p.m.

Thank you Ralph and Eric!

It looks like I am able to deliver the kind of field my users are looking for with javascript.  Thank you both!

Eric Jodet commented Sep 24 '13, 12:45 a.m.

 Glad we could help, Vince.

(Thanks Ralph)

Your answer

Register or to post your answer.