It's all about the answers!

Ask a question

Script-based default value for contributor type attributes


Makson Lee (41024241) | asked Sep 25 '11, 2:32 a.m.
Hi All,

we tried to use a custom script to provide a default value for "Owned By" attribute, in the script, we simply return a user id as a string object, but it seems didn't work, can somebody help?



dojo.provide("com.example.DefaultValueProvider");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {

return "makson";

}
});
})();


Regards,
Makson

5 answers



permanent link
Michael Walker (99215201157) | answered Oct 04 '11, 1:39 p.m.
Hi All,

we tried to use a custom script to provide a default value for "Owned By" attribute, in the script, we simply return a user id as a string object, but it seems didn't work, can somebody help?



dojo.provide("com.example.DefaultValueProvider");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {

return "makson";

}
});
})();


Regards,
Makson


You need to return the UUID of the owner rather than just the ID. The link below contains an example script on how to retrieve the UUID of the user. Following the examples, I put the UUID value in the config source rather than in the script so it would be easier to change.

https://jazz.net/wiki/bin/view/Main/AttributeCustomizationExamples

permanent link
Michael Walker (99215201157) | answered Oct 04 '11, 1:45 p.m.
Hi All,

we tried to use a custom script to provide a default value for "Owned By" attribute, in the script, we simply return a user id as a string object, but it seems didn't work, can somebody help?



dojo.provide("com.example.DefaultValueProvider");

(function() {
dojo.declare("com.example.DefaultValueProvider", null, {

getDefaultValue: function(attribute, workItem, configuration) {

return "makson";

}
});
})();


Regards,
Makson


You need to return the UUID of the owner rather than just the ID. The link below contains an example script on how to retrieve the UUID of the user. Following the examples, I put the UUID value in the config source rather than in the script so it would be easier to change.

https://jazz.net/wiki/bin/view/Main/AttributeCustomizationExamples

permanent link
Makson Lee (41024241) | answered Oct 05 '11, 2:45 a.m.
Hi Michael,

thanks for your reply, now i am trying to set the default value for "Owned By" field of work item to currently signed-in user, do you know how to get the currently signed-in user information?

Regards,
Makson

permanent link
Jay Cagle (2111) | answered Oct 10 '11, 2:00 p.m.
i am trying to set the default value for "Owned By" field of work item to currently signed-in user, do you know how to get the currently signed-in user information?


You can use the Implied Attributes precondition to set the Owner to the Current User when the user performs a Start Working or Resolve action. Go to Project Configuration->Team Configuration. Select the Save Work Item operation then add the Implied Attributes precondition. No scripting required.

permanent link
Makson Lee (41024241) | answered Oct 10 '11, 9:21 p.m.
Hi Jay,

thanks for your reply, but what if i want to set the owner to currently signed-in user when a work item is creating?

Regards,
Makson


i am trying to set the default value for "Owned By" field of work item to currently signed-in user, do you know how to get the currently signed-in user information?


You can use the Implied Attributes precondition to set the Owner to the Current User when the user performs a Start Working or Resolve action. Go to Project Configuration->Team Configuration. Select the Save Work Item operation then add the Implied Attributes precondition. No scripting required.

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.