How do I automate setting remaining work to '0' when the state of a task is set to DONE ?
Erwin Kunz (946●8●70●86)
| asked Jul 03 '12, 7:52 a.m.
edited Jul 03 '12, 8:13 a.m. by Geoffrey Clemm (30.1k●3●30●35)
I would like to force the Remaining Work to ZERO when the developer sets the Task to DONE
I didn't found anything in the process configuration. Only thing I saw, would be creating a script and include it as Follow-up action. What is for me a bit high-end :-( If somebody has a real example of setting an attribute on state change he could share with me. With all installation instruction for dummies :-) it would be great Thanks erwin |
Accepted answer
/** Ralph Schoon selected this answer as the correct answer
Comments Great Erwin! Please let me know if I shall accept this answer as accepted answer.
Erwin Kunz
commented Apr 18 '13, 7:32 a.m.
Hi Ralph
|
One other answer
Ralph Schoon (63.6k●3●36●46)
| answered Jul 05 '12, 7:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 05 '12, 7:14 a.m.
Hi Erwin, I tried it with a scripted value provider https://jazz.net/wiki/bin/view/Main/AttributeCustomization and it did NOT work.
I am assuming, since the scripting interface is still very limited, I can not read or write the duration, so the script below does not work. I would assume you have to write a follow up action. https://jazz.net/library/article/634 shows how to do that. your case is very simple and should be easy enough to do. Here is another article with a good overview https://jazz.net/library/article/784 This does unfortunately NOT work: /******************************************************************************* * Licensed Materials - Property of IBM * (c) Copyright IBM Corporation 2012. * * Note to U.S. Government Users Restricted Rights: Use, * duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. *******************************************************************************/ dojo.provide("com.ibm.js.rtc.wi.valueprovider.calculated.timeremaining"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); dojo.require("dojo.date"); dojo.require("dojo.date.stamp"); (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("com.ibm.js.rtc.wi.valueprovider.calculated.timeremaining", null, { getValue: function(attributeId, workItem, configuration) { console.log("Start.."); var aState= workItem.getValue(WorkItemAttributes.STATE); var timeremainig = workItem.getValue(WorkItemAttributes.TIME_SPENT); // var time = dojo.date.stamp.fromISOString(timeremainig); // dojo.date.stamp.toISOString(0, {milliseconds:true, zulu:true}); console.log("State: [" + aState + "]"); console.log("timeremaining: [" + timeremainig + "]"); console.log("timeremaining: [" + time + "]"); // New if (aState == "1") return timeremainig; // In Progress if (aState == "2") return timeremainig; // resolved if (aState == "3") parseInt("0"); // ReOpen if (aState == "6") return timeremainig; // Verified if (aState == "4") return timeremainig; // No state if (aState == "") return timeremainig; // No Match return timeremainig; } }); })(); |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.