It's all about the answers!

Ask a question

How to keep the order of enumeration when updating a property with REST API

Alain robert (1156) | asked Mar 13 '16, 12:50 a.m.
I have been able to use the REST API to update attributes in work items. So far this method is working fine

and I pass a json object { "Fixed_Versions_EL": [ "1.0", "1.1", "1.2"] }

This is working for all attributes, but I do have an issue with a field that is of type Enumeration List. In that case the order that I commit is not the one I see in the work item. For example the above request  will show up as 1.1 , 1.0, 1.2 which is correct but not what I expected..

Is there a way to prevent this, how can I keep the order. ( our server is running 5.0.2 ifix012 )

Donald Nong commented Mar 13 '16, 8:26 p.m.

Enumeration list does not have an "order" if I understand correctly. It may well be how the values are presented, rather than how they are updated. What's the attribute presentation in the work item editor? How does it actually look?

A screenshot may help a lot but you have to attach it somewhere else due to your low reputation.

Alain robert commented Mar 13 '16, 11:57 p.m.

Thanks for getting back to me
so this is what I get when i post the change 8.8, 8.7, 8.6,  from highest to lowest
enuneration list

The editor is defined like that

If I use the web editor, I am able to add each value in the order I want and this order is kept when i reopen a work item. I wish I could reproduce that when I edit with the REST api.

Alain robert commented Mar 20 '16, 3:40 a.m.

any suggestion?

Donald Nong commented Apr 20 '16, 9:54 p.m.

What I found is that when using OSLC API, the enumeration list order appears to be the same as the IDs (smaller number first). It may be that the code actually does sort the enumerations first before updating. I have found no way to carry the order in the presentation.

Be the first one to answer this question!

Register or 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.