It's all about the answers!

Ask a question

How do I trigger a workitem (task in this case) to be automatically created based on a change in state for a Defect workitem

steve martino (6689) | asked Nov 16 '17, 8:34 a.m.

When managing defects I would like to have CCM automatically create a task based on state/status changes of a defect workitem. Looking for any information to help develop this.

2 answers

permanent link
Ulf Arne Bister (1.3k213) | answered Nov 16 '17, 11:20 a.m.


if you want to develop this you need a server side extension against the RTC Java API. Basics are shown in the freely available Extension workshop on :
My company Method Park actually wrote a generic plugin for this to be configured from modelled process. So this is commercially available or you would have to write your own.

- Arne

Ralph Schoon commented Nov 17 '17, 2:18 a.m.

In addition to Arnes answer provides a bit more information and see my answer to for links how to create work items in the server API.

permanent link
Luca Martinucci (1.0k293111) | answered Nov 17 '17, 5:07 a.m.

I've done such an automation several times.
Here are some code snippets (using server-side Java API) that could help you.

// create a workitem
IWorkItemServer workItemServer = ....;
IWorkItemType workItemTargetType = ......;
IWorkItem workItemTarget = null;
workItemTarget = workItemServer.createWorkItem2(workItemTargetType);
// set the attributes
IAttribute attribute = ....;
Object attributeValue = ...;
workItemTarget.setValue(attribute, attributeValue);
// create link with parent workitem ("sourceWorkItem")
IWorkItem sourceWorkItem = ...;
references = workItemServer.resolveWorkItemReferences(workItemTarget, null);
references.add(WorkItemEndPoints.PARENT_WORK_ITEM, WorkItemLinkTypes.createWorkItemReference(sourceWorkItem));
// save the workitem
workItemServer.saveWorkItem2(workItemTarget, references, null);

Ulf Arne Bister commented Nov 17 '17, 5:51 a.m.

The actual work in implementing this is covering all Exceptions, checking mandatory fields, checking for StaleDate before saving ...
If you want this to be productive in a setting with >100 users I can only recommend to figure in a factor of x3 - x5 on the time you actually need for coding the plugin to test and deploy.
If you write more than one plugin against e.g. Work Item Save, order of execution is not guaranteed so you have to make sure the plugins play nice with each other. The extensions workshop covers most of the basics there.

Your answer

Register or to post your answer.