Is it possible to programmatically create a work item in a seperate Project Area
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
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
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
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
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);
1 vote
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 ?
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"
1 vote