How to set the values programmatically which is non-editable from the process configuration
Hi,
I am planning to set a value programmatically in an attribute each time I save the work item. i am facing some issues while setting a value to an attribute as that attribute is read-only field(which is done by process configuration manually). Below is the code to set the value of an attribute.
public void setCustomStringAttributeById(String attrId, String ac)
throws InvalidAttributeIdException {
IAttribute attr = customAttributes.get(attrId);
if (attr == null) {
throw new InvalidAttributeIdException("No attribute with ID["
+ attrId + "] found.");
}
workItem.setValue(attr, ac);
}
ac is the value which we want to set(it may be hard coded).
It is giving me below error while saving the work item
Problem
The 'Feedback' attribute is not modifiable .
Please let me know what I am missing . Thanks in advance
One answer
I don't know if you can do this in each context though. Try to make it not read only. If it works then, it might be impossible in your context - if it still does not work then there is a different problem. If the error message is accurate I have no idea, otherwise show the real error message.
Please note, there are attributes that you can not modify e.g. modified date and id.
Comments
I have to correct myself. I just forgot to save the process change. I am not able to modify the read only attribute using a Java Client. I see
CRRTC0299E: The work item with the ID 93 cannot be saved because an attempt was made to change the attributes '[Custom Boolean]' which are not modifiable.
You would have to leave the attribute as writable and make it read only in the editor presentation, I think.
Comments
Donald Nong
Jul 28 '15, 2:02 a.m.The code is irrelevant. Why do you think you should be able to set value for a read-only field?