It's all about the answers!

Ask a question

Is it possible to programmatically create a work item in a seperate Project Area


1
1
derry davis (23222016) | asked Jun 25 '12, 4:13 p.m.
edited Jun 25 '12, 4:42 p.m. by Seth Packham (1.4k42213)
Is it possible to programmatically create a work item via the process adviser and/or OSLC from one project area, say A, into another project area, say B.
Assumptions are that the user has proper access to both project areas and that the work item creation is trigger upon save of a 'parent' work item.
A possible scenario we have is:
Story work items have child task work items. A project manager creates a story work item that has several child tasks related to it. Project manager wants to be able to select an user (or list of users) for which tasks will be generated and linked to the story. These tasks may be in another project area.
Thanks in advance.
Derry

2 answers



permanent link
Antonio Bonanni (1111717) | answered Jun 27 '12, 8:17 a.m.
Surely you can. I solved a similar situation with OperationParticipant Java plugin ( Server Side ).

Your scenario is a little different from mine, but the workitem creation is not different i think. When the PM select user and tasks you have to link/create this tasks in other project areas.



I hope this help

Comments
Chirayu Patel commented Oct 18 '12, 2:32 p.m.

Antonio,

Can you elaborate more on this solution ? I am trying to create work item in Project B when the operation particpant of Project A is invoked. I am not sure on how to get the Project B handle from Project A. Some high level code will help


1
Jared Russell commented Oct 19 '12, 4:27 a.m.

 You need to use the IAuditableServer class to obtain a reference to project area B. Example code:


String projectAreaUri = ...
String targetTypeIdentifier = ...
IAuditableServer auditableServer = getService(IAuditableServer.class);
URI uri = URI.create(projectAreaUri);
IProjectArea projectArea = (IProjectArea) auditableServer.findProcessAreaByURI(uri, null, null);
IWorkItemType targetWorkItemType = 
workItemServer.findWorkItemType((IProjectAreaHandle)projectArea.getItemHandle(), 
targetTypeIdentifier, null);
IWorkItem targetWorkItem = workItemServer.createWorkItem2(targetWorkItemType);


Chirayu Patel commented Oct 19 '12, 9:34 a.m.

Jared,

WHat is projectAreaUri - Is it name or UUID of the project B ?

WHat is the targetTypeIdentifier - Is it name or UUID of WorkItem that I want to create ?


1
Jared Russell commented Oct 19 '12, 12:31 p.m.

It's the URL encoded name of your project (e.g. spaces become %20, parens become %28 and %29, etc). E.g. "My Project (Requirements)" would become something like "My%20Project%20%28Requirements%29"


permanent link
Muthukumar C (32712833) | answered Jun 27 '12, 8:55 a.m.
It is possible to Create work item programmatic in any project area. In Server side plugin, CreateWorkItemw2 method will get the type of the work item as parameter. that will decide in which area that work item should get created.

Regards
Muthukumar.C

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.