Problem when creating a new defect in rtc
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
5 answers
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
2. I use code like the below to make sure the attribute actually exists on the element (especially for modify). i have seen a bunch of people using the display name instead of the ID and fetching the wrong attribute, that actually was not defined or used for a type, in which case you just get issue. Otherwise, I can't tell. Kind of hard to debug on my end, missing the schema and the complete code.
IAttribute customString = workItemClient.findAttribute(fProjectArea,
fCustomStringAttributeID, null);
if(null!=customString){
if(workItem.hasCustomAttribute(customString))
workItem.setValue(customString, fCustomString);
}
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
Comments
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
I've put the sysout solution so I can show you... the values are set Is set =true value com.ibm.team.workitem.common.model.ILiteral:ODC_Defect_Target.literal.l6 Is set =true value com.ibm.team.workitem.common.model.ILiteral:ODC_Activity.literal.l18 Is set =true value com.ibm.team.workitem.common.model.ILiteral:ODC_Impact.literal.l16
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
Hi, didn#t notice the sysout. I am not sure what the issue is. Is "ODC_Impact" the ID of the attribute? I would, in my test system, remove the required attribute condition and try if the values are showing. You can enable them again later. If the code works for one type and the other type is correctly defined and you are using the correct attribute I'd, i would expect it to work.
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
it is possible to remove the required attribute? and yes, tge ODC_Impact is the id of the attribute.
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
Well, you or someone else has defined the required attributes in your process, of course you can remove them.
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
There is the removeCustomAttribute method .. but using it does not affect the repository workflow in any way?
![](http://jazz.net/_images/myphoto/41baa316cc28945467a050502ea9d89b.jpg)
Sorry, but I have used the removeAttribute for the custom attributes but I still get the same problem .. that ODC .... is not set. I really don;t know what is the source of my problem...
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
No, you have to go into the process template (with the eclipse client) and change it to not require the attributes for the new state. The process template has rules set in the team configuration, permissions or operational behavior. Talk to the person that created the template. Removing the attribute has the same effect - it is not there, it is not set, no save.