Unable to setValue for a custom Attribute
Hi,
i am using plain java API to get connected with RTC from eclipse.
I have n number of custom attributes.
Some of them I can set value using the literal value ( workItem.setValue(attrWic,"ILiteral:cmoCategory.literal.l4");)
but some I am not able to set the value
When I do getValue i get different scenarios.
Scenario 1
workItem.getValue(iAttribute1).toString(); returns affected_environments.literal.l1
Scenario 2
workItem.getValue(iAttribute2).toString(); returns com.ibm.team.workitem.common.model.ILiteral:cmoCategory.literal.l3
Anything that has output like scenario 2 I am unable to setValue() I am getting following error message
Exception occurred during playback of script [Script1] [CRFCN0019E: RationalTest
ScriptException on line 48 of script Script1 - java.lang.ClassCastException: jav
a.lang.String incompatible with com.ibm.team.workitem.common.model.Identifier.].
Please suggest me how to set value for such custom attributes.
Thanks
i am using plain java API to get connected with RTC from eclipse.
I have n number of custom attributes.
Some of them I can set value using the literal value ( workItem.setValue(attrWic,"ILiteral:cmoCategory.literal.l4");)
but some I am not able to set the value
When I do getValue i get different scenarios.
Scenario 1
workItem.getValue(iAttribute1).toString(); returns affected_environments.literal.l1
Scenario 2
workItem.getValue(iAttribute2).toString(); returns com.ibm.team.workitem.common.model.ILiteral:cmoCategory.literal.l3
Anything that has output like scenario 2 I am unable to setValue() I am getting following error message
Exception occurred during playback of script [Script1] [CRFCN0019E: RationalTest
ScriptException on line 48 of script Script1 - java.lang.ClassCastException: jav
a.lang.String incompatible with com.ibm.team.workitem.common.model.Identifier.].
Please suggest me how to set value for such custom attributes.
Thanks
2 answers
My experience is that the literal ID follows the colon (:) in the result of workItem.getValue(iAttribute2).toString()
Look at your Process Source for the enumeration. You're likely to find id="cmoCategory.literal.l3" but not the other.
So try split(":") to get the parts, use the 2nd for the value to workItem.setValue() method.
Look at your Process Source for the enumeration. You're likely to find id="cmoCategory.literal.l3" but not the other.
So try split(":") to get the parts, use the 2nd for the value to workItem.setValue() method.
There is some code that might help here: https://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/ . I am not sure what the issue is.