How to create a script to auto assign defects to a specifc user for specific states?
![]()
Forwarding this question on behalf of one of our customers.
----- I have been trying to set-up a script to auto assign Defects to a specific user for specific states e.g when a defect is fixed it should be assigned to "Quality" user. I used the following script to set the default value but this did not work. ----- dojo.provide("org.example.CalculatedOwner"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; var CalculatedOwner= dojo.declare("org.example.CalculatedOwner", null, { getValue: function(attributeId, workItem, configuration) { if (workItem.getValue(WorkItemAttributes.TYPE) === "defect" && workItem.getValue(WorkItemAttributes.STATE) === "5") { return configuration.getChild("parameters").getStringDefault("owner", "Quality"); } else { return workItem.getValue(WorkItemAttributes.OWNER); } } }); })(); ----- ----- Thanks for you help |
4 answers
![]()
Ralph Schoon (62.0k●3●36●43)
| answered Jan 15 '15, 3:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jan 15 '15, 3:52 a.m.
Please read (and perform) the Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management as this will answer most of your questions and also describes how to debug this.
In general, in Java script, you can set a user/contributor type attribute, you must however provide the UUID of the user as far as I know. You can
You can use the data you get with the attribute spy script in the lab 5 (for the user you want) and return that.
If you need more advanced features, you can use Java to create extensions.
See https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ as an example for how to create java based value providers and see https://rsjazz.wordpress.com/2012/11/30/a-create-approval-work-item-save-participant/ that explains how work items can be modified in a follow up action. you can use this approach also and you would have full access to all data.
|
![]()
Thank you all. I'm going through the Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management workshop and will provide feedback soon.
|
![]()
Hi All
I managed to resolve this by going through the information available on https://jazz.net/wiki/bin/view/Main/AttributeCustomization |
Comments
Hy LD,
What error do you get?
With this Information, I won't know, if there's a problem with your code or the Syntax in dojo.
Please give us this information. Then I might can answer.
@Jonas, thanks for your quick answer. The customer did not get any visible errors, he check the logs and submit an update.