Set owner script - graceful way to not execute?
Terry Kemp (35●10●12)
| asked Jun 21 '12, 1:57 p.m.
retagged Jun 26 '12, 4:15 p.m. by Evan Hughes (2.4k●13●18)
I have successfully built a script that sets the Owned by attribute based on the value selected in an enumeration. I then wanted to have it also check a boolean attribute and if that boolean is false, to NOT set the Owned by field, but to let the user set it. I have this working, but not gracefully.
Below is a snippet of the code. For the "else" condition I am simply returning an empty string instead of a UUID. This has the intended effect - the Owned by attribute is not set automatically, but it of course results in a null pointer exception. I was wondering if there was a better way to accomplish this so as not to throw an error? (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; var SetECMOwner= dojo.declare("org.example.SetECMOwner", null, { getValue: function(attributeId, workItem, configuration) { // retrieve state of auto-assign attribute var autoAssign = workItem.getValue("delegateflag"); // if auto-assign is turned on (by default), execute the body of the script if (autoAssign == true ) { DO SOME STUFF; return UUID } else { return ""; } |
One answer
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.