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 (6668) | 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.3k7) | answered Nov 16 '17, 11:20 a.m.

Steve,

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 jazz.net : https://jazz.net/library/article/1000
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


Comments
1
Ralph Schoon commented Nov 17 '17, 2:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

In addition to Arnes answer https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ provides a bit more information and see my answer to https://jazz.net/forum/questions/246919/how-to-create-child-workitems-automatically-when-parent-is-created for links how to create work items in the server API.


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

Steve,
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);




Comments
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.