Is there any way to retrieve all Options for a Enumeration (including description) in Polarion?
I have tried multiple things:
- Searching the enum via Dataservice
$trackerService.getDataService().getEnumerationObjectFactories().get("@WorkItems").getEnumeration("processes-enum.xml", $contextId).getAllOptions().get(0)
this does return an EnumOption, but its from the "wrong side". If i use .getName() or getId() it returns the name and Id of a Workitem (so getAllOptions means I get all possible Applications for an Enumeration but not the content of the actual Enumeration file.
- Using custom Fields
#set($projectId = $page.getReference().projectId())
#set($trackerProject = $trackerService.getTrackerProject($projectId))
$trackerProject.getWorkItem("myWorkitem").getCustomField("myEnum").getProperty("description")
This correctly gets the description for the EnumOption for myWorkitem for myEnum. This is already good, but now I can only access EnumOptions descriptions that are "used" in a Workitem.
- CustomFieldsService
#set($customFieldsService = $trackerService.getDataService().getCustomFieldsService())
$customFieldsService.getCustomField("myEnum", "WorkItem", $contextId)
This correctly returns an instance of a CustomField, but this doesnt really help me, since I can't search for all possible Options for this Custom Field
Is there something I am missing? Is there a way to access the description of EnumOptions for an Enum in Polarion?
Using
.getClass().getName()on the output ofgetCustomField(key), I learned that it actually is anAbstractTypedListwhich has a get(int) method.Retrieving the first item of the field suddenly lets you call the
idproperty: