It's all about the answers!

Ask a question

Set owner script - graceful way to not execute?

Terry Kemp (351012) | asked Jun 21 '12, 1:57 p.m.
retagged Jun 26 '12, 4:15 p.m. by Evan Hughes (2.4k1318)
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=;

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 ) {
       return UUID
   else {
       return "";

One answer

permanent link
Arne Bister (2.6k12832) | answered Jun 23 '12, 10:46 a.m.

I might be missing something but why not simply return the unassigned value for your OwnedBy field (usually "unassigned")? Would that have undesired side effects for your use case?

- Arne

Terry Kemp commented Jun 26 '12, 3:26 p.m. | edited Jun 26 '12, 4:15 p.m.

Thanks for the input.  Unassigned is not the desired end result, but rather whatever owner the user selects.  After thinking about it some more seems the answer is:


So basically setting owner to whatever owner is set to - the value the user specified.

Your answer

Register or to post 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.