It's all about the answers!

Ask a question

Get list of all Categories from server side


pere irazusta (2062120) | asked Feb 27 '12, 6:59 a.m.
Hi,

I'm developing a server side plugin that enables to setCategory of a workitem depending on the value of other workitem fields.

I've found some snippets that solve this issue ( listting all the catgories and getting one of them) before setting it but using client side libs.

 IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);

...
ICategoryHandle category = workItemClient.findCategoryByNamePath(projectArea, path, null);
wc.getWorkItem().setCategory(category )



Any idea on how to do it from server side?

Thanks!

Pere

3 answers



permanent link
Ralph Schoon (63.1k33645) | answered Feb 27 '12, 10:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Pere,

on the server, provided your extension extends the AbstractService (which it should) you can use the getService() operation to get the services that provide this. In your case:


IWorkItemCommon common = (IWorkItemCommon)getService(IWorkItemCommon.class);
common.findCategoryByNamePath(projectArea, namePath, monitor)

permanent link
pere irazusta (2062120) | answered Feb 27 '12, 10:30 a.m.
Thanks Ralph for your quick answer!

It looks like it will work fine.

I 'll let you know the final results.

Pere.

permanent link
Jos Olminkhof (633) | answered Feb 27 '12, 1:13 p.m.
We have just started using RTC for managing product enhancement requests. A few challenges are left. One of them is this:

We want to populate the "Owned By" field based on the selected value for a "Product" field? For each product we have one product owner. How/where can we maintain a product - product owner table and what would a script to set the "Owned By" field look like. (assuming it can be scripted)

thanks!
Jos.
p.s. we do know some JavaScript, but are new to building script for RTC

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.