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

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

0 votes

Comments

The code is irrelevant. Why do you think you should be able to set value for a read-only field?



One answer

Permanent link
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.

0 votes

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.

Your answer

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
× 10,936
× 411

Question asked: Jul 28 '15, 1:38 a.m.

Question was seen: 3,208 times

Last updated: Jul 28 '15, 3:17 a.m.

Confirmation Cancel Confirm