Get list of all Categories from server side
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.
Any idea on how to do it from server side?
Thanks!
Pere
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
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:
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)
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
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