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

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

0 votes


Be the first one to answer this question!

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: May 04 '19, 5:55 a.m.

Question was seen: 852 times

Last updated: May 04 '19, 5:55 a.m.

Confirmation Cancel Confirm