I know that this is a very common topic, seems like I am not the only one with problems to create a work item and set the enum value of its custom fields. But I had a look at all topics dealing with enums here in the forum but still have no clue what I am doing wrong.
I am using Python to access the Polarion web service, the connection itself is working and I can query and create work items.
Here is the relevant part where I create my work item:
Code: Select all
wi = self.polarion.tracker.factory.create('tns3:WorkItem')
wi.project = self.polarion_prj
wi.type.id = 'LLI_data'
wi.title = title
custom_path = self.polarion.tracker.factory.create('tns3:CustomField')
custom_path.key = 'cf_path_prefix'
custom_path.value = prefix
custom_ddm = self.polarion.tracker.factory.create('tns3:CustomField')
custom_ddm.key = 'cf_sddm'
enumOpt_sddm = self.polarion.tracker.factory.create('tns3:EnumOptionId')
enumOpt_sddm.id = 'sddm1'
custom_ddm.value = enumOpt_sddm
wi_uri = self.polarion.tracker.service.createWorkItem(wi)
The work item is created in Polarion without causing an exception, the custom field cf_path_prefix is filled as intended but the cf_sddm field stays "not selected".
When I query the work item in my script and print it there is no information at all about the cf_sddm in it.
I also experimented with tns3:Custom instead of tns3:CustomField for both custom fields with the same result. The path is filled, the sddm value is unset. So I hope some else can help me out here.