Set Enum in new created Workitem

Description
scharph
Posts: 1
Joined: Wed Jul 04, 2018 9:19 am

Set Enum in new created Workitem

Postby scharph » Wed Jul 04, 2018 12:53 pm

I want to create a new Workitem and set the value of a custom field("interface").

The custom field has type enum and there a multiple values possible!
The enum is custom created in a [workitem]-[title]-enum.xml in the same project

My Problem:
i have the id("team_6") of the enum which should be added, but i have no idea how to add them to the custom field


i tried this:

Code: Select all

  $newWorkitem.setCustomField("interface", $ENUM.wrapOption("team_6"))


Wrapped Exception: Invocation of method 'setCustomField' in class com.polarion.alm.tracker.internal.model.WorkItem threw exception class java.lang.ClassCastException : com.polarion.platform.persistence.spi.DelegatingOption cannot be cast to com.polarion.platform.persistence.spi.CustomTypedList

also this:

Code: Select all

$newWorkitem.setEnumerationValue("interface", "team_6"))


same problem:

Wrapped Exception: Invocation of method 'setEnumerationValue' in class com.polarion.alm.tracker.internal.model.WorkItem threw exception class java.lang.ClassCastException : com.polarion.platform.persistence.spi.DelegatingOption cannot be cast to com.polarion.platform.persistence.spi.CustomTypedList

For the severity enum this is working but not with my custom enum.
Where do i get this CustomTypedList??

This is my Code:

Code: Select all

$transactionService.beginTx()

#set( $newWorkitem = $trackerProject.createWorkItem("agenda") )
$newWorkitem.setTitle("My Workitem Title")
$newWorkitem.setDueDate($objectFactory.newDateOnly($dateTool.toDate("yyyy-MM-dd", "2018-02-20")))

$newWorkitem.setEnumerationValue("severity", "A")
$newWorkitem.setCustomField("catchWords", "Schlagwort")

$newWorkitem.setCustomField("interface", ???????)

##$ENUM.wrapOption("team_6") $ENUM.wrapOption("team_6").class

$newWorkitem.save()

##$transactionService.commitTx()
#info("Done.")


Thank you
Best regards Philipp

Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 2 guests