Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Script-based default value for contributor type attributes

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

0 votes



5 answers

Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 25 '11, 2:32 a.m.

Question was seen: 5,831 times

Last updated: Sep 25 '11, 2:32 a.m.

Confirmation Cancel Confirm