It's all about the answers!

Ask a question

Is exist two attribute that type is owner in one workItem?


chen fengmiao (7032932) | asked Dec 08 '11, 11:06 a.m.
In workItem,I set two attribute that type is owner,but another attribute in javascript return null,and I use "workItem.isAttributeSet(attributeId)" ,it return false.Why?Is exist two attribute that type is owner in one workItem?

The is my code in attribute customization:
(two attribute are workItem.owner and a attribute customization that type is owner)

dojo.provide("org.example.validateDevelopPerson");

dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var Severity= com.ibm.team.workitem.api.common.Severity;
var Status= com.ibm.team.workitem.api.common.Status;
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var validateDevelopPerson= dojo.declare("org.example.validateDevelopPerson", null, {
validate: function(attributeId, workItem, configuration) {
var severity= configuration.getChild("parameters").getStringDefault("severity", Severity.ERROR.name);
var message= configuration.getChild("parameters").getStringDefault("message", "");
var state = workItem.getValue(WorkItemAttributes.STATE);
console.log("attributeId:"+attributeId)
var developPerson = workItem.getValue(attributeId);
console.log("developPerson:"+developPerson)
console.log("isAttribute:"+workItem.isAttributeSet(attributeId))
var owner = workItem.getValue(WorkItemAttributes.OWNER);
console.log("state:"+state)
if(state === null){
return Status.OK_STATUS;
}
else{
if(state==="com.ygsoft.workflow.interiorDebugBill.state.s4"){
if(developPerson===owner){
return Status.OK_STATUS;
}else{
return new Status(Severity[severity], message);
}
}else {

return Status.OK_STATUS;
}
}
}
});
})();


log message print:

LOG:attribueId:AtrDevelopResponsePerson
LOG:developPerson:null
LOG: is:false
LOG:state:

One answer



permanent link
VK L (8177157159) | answered May 22 '13, 4:32 a.m.
 Hi Chen,
                  try to give attributeId in quotes: Is AtrDevelopResponsePerson, the id of the other owner-type attribute?

workItem.getValue("attributeId");
	

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.