Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.

0 votes



2 answers

Permanent link
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);
            }
        }

1 vote


Permanent link
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.


0 votes

Comments

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

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Mar 24 '14, 1:24 a.m.

Question was seen: 7,521 times

Last updated: Apr 11 '14, 2:30 a.m.

Confirmation Cancel Confirm