It's all about the answers!

Ask a question

RTC How to get the values of a Enumerated list in script


Janet Cook (23110) | asked Dec 10 '23, 6:57 p.m.

 Workflow manager (RTC) 7.0.2


I have a attribute that is a enumerated list thus having possibly multiple values. I need to query these values in a script to set another attribute but it seems not to work. I can get the number of values that are set, but how to I get to the actual values?  Code I have is

       var AttValueList = workItem.getValue("change_system");
       var numvals = AttValueList.length
       var System = "TESTXXXX...";
       for (var i = 1; i <= numvals; i++) {
           System = System + i +  AttValueList[i].id  
// the above line works without the
     // +  AttValueList[i].id 
//  part so I know I am going through the loop

// what I am really after is this
//        if (AttValueList[i].id === "SystemENUM.literal.l2") {System = System + "RS ";}
       }

I must be missing something simple but cannot figure it out.
Thanks

2 answers



permanent link
Davyd Norris (2.9k217) | answered Dec 10 '23, 7:24 p.m.

Try AttValueList[i].content


Comments
Janet Cook commented Dec 10 '23, 7:46 p.m.

 Thanks Davyd


Tried that and it gives me undefined for all values.

Any further ideas?
Janet


Davyd Norris commented Dec 11 '23, 2:17 a.m.
Hmmmm - that's what you use for String Lists, but it looks like Enumeration Lists are a lot quirkier.

I've just been digging round in the code and they are not treated the same way as either String Lists or Enumerations. They seem to be considered Value Sets but the code that retrieves the values is very obscure. I'll do some more digging

permanent link
Janet Cook (23110) | answered Dec 10 '23, 7:45 p.m.

 Thanks Davyd,

Tried that and it gives me undefined for all values when I know some of them are set.
Any furhehr ideas?
Janet

Your answer


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.