It's all about the answers!

Ask a question

Can we programmatically create work item/s using work item templates in RTC?


Rahul Kulkarni (111) | asked Mar 24 '14, 1:24 a.m.
RTC SDK APIs provide automation in creating and updating work items. RTC also supports work item templates to create work item/s using UI based on template configured in RTC. Is there support for creating work item/s based on work item templates using RTC SDK APIs? If yes, then can someone please provide a head start?

Thanks.

2 answers



permanent link
Harshal Bhavsar (111) | answered Apr 11 '14, 2:30 a.m.
Thanks Ralph for help and Rahul for asking question!

  I found this code working to create workitems using templates.
Method call "instantiateTemplate" basically creates WI using process templates

IWorkItemTemplateClient witc = (IWorkItemTemplateClient) repository.getClientLibrary(IWorkItemTemplateClient.class);
        String projectAreaName = "Project name;
        IProcessClientService processClient = (IProcessClientService) repository
        .getClientLibrary(IProcessClientService.class);
        URI uri = URI.create(projectAreaName .replaceAll(" ", "%20"));
        IProjectArea projectAreaHandle = (IProjectArea) processClient.findProcessArea(uri, null, null);
        System.out.println(projectAreaHandle.getName());
        List<IWorkItemTemplateHandle> templateHandles = witc.getTemplateHandles(projectAreaHandle, monitor);
        for(IWorkItemTemplateHandle templateHandle : templateHandles){
            if(templateHandle.getName().equals("Epic Template")){
                System.out.println("Name===="+templateHandle.getName());
                Map<IAttributeVariable, Object> map = new HashMap<IAttributeVariable, Object>();
                int[] count = witc.instantiateTemplate(templateHandle, map, monitor);
            }
        }

permanent link
Ralph Schoon (63.1k33646) | answered Mar 24 '14, 4:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Rabul,

looking at the Eclipse client you can see where this is done in the Client SDK:


If you go into the code, you can see this code:



I am not sure if IWorkItemTemplateClient is in the plain JavaClient Libraries, but it is the class that is used in the RTC Eclipse client.



Comments
Ralph Schoon commented Mar 24 '14, 6:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Just checked and the JavaDoc ofthe Plain Java Client Libraries shows IWorkItemTemplateClient being available.

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.