Script based Default Value
Hi
I'm trying to create a new "Script Based Default Value" customization. It is simple just to hard code the owner of a certain type of workitem. I have created calculated value scripts before and they run ok.
But I'm having trouble with the default value, is the structure the same?
This is my code :
This is my code :
dojo.provide("Default_Value.task");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("Default_Value.task", null, {
getValue: function(attributeId, workItem, configuration) {var wi_type = workItem.getValue(WorkItemAttributes.TYPE);var wi_owner = workItem.getValue(WorkItemAttributes.OWNER);console.log("Type - " + wi_type);console.log("Owner - " + wi_owner);if (wi_type == "task"){wi_owner = "_p_g14CR6EeWmoeAO1lg85w";}return wi_owner;}});})();
Thanks
Accepted answer
The function should be getDefaultValue, not getValue. You can use the "Fill in example" link to get the skeleton of the script to avoid such simple mistake.
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_based_default_values