How do I trigger a workitem (task in this case) to be automatically created based on a change in state for a Defect workitem
2 answers
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
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.
1 vote
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
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.