Issue with the edit work item when it has read only attribute
Hello All,
Can anyone please help on the below scenario?
I have created a customized attribute Demand ID for work item with read only setting.
When I am creating the work item the Demand ID is generating correctly, but when I am trying to edit the work item.
It is showing the below error.
"CRRTC0299E: The work item with the ID 2028 cannot be saved because an attempt was made to change the attributes '[Demand ID]' which are not modifiable."
I want the Demand ID attribute with read only setting, and I have to edit the work item.
Below is the script which I have written:
dojo.provide("org.example.workitems.providers.ZScript");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date.stamp");
dojo.require("dojo.date.locale");
(function() {
var WorkItemAttributes=com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.ZScript", null, {
getValue: function(attributeId, workItem, configuration) {
var currentDate = new Date();
console.log("current Date = " +currentDate);
var year = dojo.date.locale.format(new Date(currentDate), {datePattern: "yyyy" , selector: "date"});
console.log(" Current year == "+year);
var demandID = workItem.getValue(WorkItemAttributes.DEMAND_ID);
console.log("demandID = " +demandID);
var internalID=workItem.getValue(WorkItemAttributes.ID);
console.log("internalID === " +internalID);
var state=workItem.getValue(WorkItemAttributes.STATE);
console.log("Status is:"+state)
if(demandID === "null"){
console.log("Answer is CR2018- "+internalID);
return "CR"+year+"-"+internalID;
}else{
return false;
}
}
});
})();
Regards