How to set the values programmatically which is non-editable from the process configuration
![]()
Arjun Pande (3●6●14)
| asked Jul 28 '15, 1:38 a.m.
edited Jul 28 '15, 2:33 a.m. by Ralph Schoon (62.3k●3●36●43) 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)
IAttribute attr = customAttributes.get(attrId);
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
Please let me know what I am missing . Thanks in advance |
One answer
![]()
Ralph Schoon (62.3k●3●36●43)
| answered Jul 28 '15, 2:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can, in principle, set a read only attribute using the API. I just did that. Also attribute customization allows to set read-only values.
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 ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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
|
Comments
The code is irrelevant. Why do you think you should be able to set value for a read-only field?