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

Set value of enum with calculated script

 Hello, 

After succeding in getting value from enum, I'm now trying to set a calculated value into an enum

I'm using 
workItem.setValue(attributeId, enumLiteral);

It works, but the value isn't changed on the fly. It is changed only after saving the workitem.
Is it possible to make it change on the fly when we change the value of another enum without saving the WI ? 

Thank you for your help

0 votes

Comments

 Hi Sany,


I have a similar requirement to what you have stated, It would helpful if you can share some knowledge on this

Gagan Kumar there is already an accepted answer to this question provided almost 6 years ago. If you have new questions to ask, please post your own question.


Accepted answer

Permanent link

Hi Sany,

instead of workItem.setValue, try applying the calculated value script directly onto the attribute, just return the value from the script.  the returned value would directly get set onto the attribute then.  this should show the changes as soon as the dependent attribute is changed.

if you are using the same script to set multiple enum attributes, you could try a conditional return as in :
    if (attributeId === "enumattributeid_1")
         return "literalidapplicablefor_1"
    if (attributeId === "enumattributeid_2")
         return "literalidapplicablefor_2"
so on...

Sany Maamari selected this answer as the correct answer

0 votes

Comments

 Yes it works, Thanks

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

Question asked: Feb 14 '17, 10:31 a.m.

Question was seen: 2,319 times

Last updated: Jan 19 '23, 12:41 p.m.

Confirmation Cancel Confirm