It's all about the answers!

Ask a question

Programatically Create work items from a work item Template


Arun Batra (14612226) | asked Apr 25 '13, 8:14 a.m.
 Hi,
I am creating an post operation participant for project initialization which will create some work items when the project is initialized.
Question 1: Which extension point do i have to extend?
Question 2: Is it possible to create work items programatically from a work item template already defined in the project?

Awaiting a reply.

Warm Regards,
Arun

Accepted answer


permanent link
Sylvain LEQUEUX (2132728) | answered May 02 '13, 6:08 a.m.
edited May 02 '13, 6:11 a.m.
Hello,

For your second question, I would say to use IWorkItemTemplateClient.

IWorkItemTemplateClient witc = (IWorkItemTemplateClient) repo.getClientLibrary(IWorkItemTemplateClient.class);
IWorkItemTemplateHandle templateHandle = witc.getTemplateHandle("Identifier", projectAreaHandle, monitor);
int[] actualIDs = witc.instantiateTemplate(templateHandle, Collections . < IAttributeVariable, Object> emptyMap(), monitor);

I now just let you find out what to put in the second attribute (didn't check) of instantiateTemplate method.
Please also not I didn't test the code I've wrote here. It might need some adjustment.

Regards,
Sylvain
Ralph Schoon selected this answer as the correct answer

2 other answers



permanent link
Lauren Hayward Schaefer (3.3k11427) | answered Apr 26 '13, 7:15 a.m.
JAZZ DEVELOPER
Hi Arun,
1.  https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation explains how to programmatically create work items.
2.  Great question!  I did a quick search, and I didn't find any examples.  It seems like it should be possible.  Perhaps someone else will know how to do this.

permanent link
Harshal Bhavsar (111) | answered Apr 09 '14, 1:52 a.m.
 Thanks Sylvain for providing probable code to access template and create workitems as per template
Hi Arun Batra,

  Have you find answer to the question you were looking for?
Even I have the same requirement in my project.Need to create work items using rtc work item templates

Request you to please post the code in case you have accomplished it
Thanks in advance!

Regards,
Harshal
    
    

Your answer


Register or to post your answer.