How to set the values programmatically which is non-editable from the process configuration
Arjun Pande (3●8●14)
| asked Jul 28 '15, 1:38 a.m.
edited Jul 28 '15, 2:33 a.m. by Ralph Schoon (63.4k●3●36●46) 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 (63.4k●3●36●46)
| 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
Ralph Schoon
commented Jul 28 '15, 3:16 a.m.
| edited Jul 28 '15, 3:17 a.m.
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
|
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.
Comments
The code is irrelevant. Why do you think you should be able to set value for a read-only field?