Updating WorkItem status + resolution via WebServices

Description
teropes
Posts: 6
Joined: Tue Dec 13, 2011 8:48 am
Location: Valtra Inc. FI-44200 SUOLAHTI
Contact:

Updating WorkItem status + resolution via WebServices

Postby teropes » Fri Dec 30, 2011 9:36 am

Greetings!

I cannot set my WorkItem status from open -> closed because of conflict in WorkItem attributes and selected workflow rules.

Explanation:

My testcase WorkItem has status options:
id: open, clears: resolution
id: closed, requires: resolution

Problem scenario:
HL-34 is a testcase with status open. The WorkItem object has no attribute of resolution (at least the object that function getWorkItemById returns). I want to update my WorkItem status to closed and I have to set the attribute resolution, because it is required.

Question:
How can I set WorkItem status to closed AND set resolution to something? WorkItem with status open does not have attribute resolution. Do I have to perform the workflowaction of "close" first and then set resolution? Do I have to fetch the WorkItem object and append it with attribute resolution somehow?

# Attempt 1 (not the actual code pasted, just the idea):

Code: Select all

wi = tracker.service.getWorkItemById(project_id, wi_id)

# try to close the workitem
tracker.service.performWorkflowAction(wi._uri, 1)

--> Results in error:

Code: Select all

com.polarion.alm.tracker.internal.workflow.ValidatorWrapper$UserFriendlyWorkflowException: The required field 'resolution' of Work Item 'HL-34' is missing!'


# Attempt 2 (not the actual code pasted, just the idea):

Code: Select all

wi = tracker.service.getWorkItemById(project_id, wi_id)
wi.status.id = "closed"
wi.resolution.id = "passed"
tracker.service.updateWorkItem(wi)

--> Results in error:

Code: Select all

WorkItem instance has no attribute 'resolution'

After several many attempts I still cant figure out a workaround? Fairly simple action seems like a huge task via WebServices...? :x

Any suggestions and help will be very much appreciated! Btw. Are there any fellow WebService users around or how come forum threads discussing such things are surprisingly quiet?

BR,
Tero Pesonen

NickEntin
Posts: 472
Joined: Tue Oct 24, 2006 10:27 am
Location: Polarion Software GmbH, Stuttgart
Contact:

Re: Updating WorkItem status + resolution via WebServices

Postby NickEntin » Sun Jan 01, 2012 8:39 pm

Hi,

I'd recommend to search for reusable examples on POP site.

Principally your code is correct, but it uses some sort of shortcuts (it's not Java syntax), which I'm not sure how is interpreted in SOAP.

this should work:
wi.setResolution(new EnumOptionId("passed"))

Best regards,
Nick

vincent.tancy
Posts: 2
Joined: Tue Aug 28, 2018 9:01 am

Re: Updating WorkItem status + resolution via WebServices

Postby vincent.tancy » Tue Aug 28, 2018 10:00 am

Hi there, anyone know how to achieve the same goal for the latest polarion 2018? Thanks.

mhoe
Posts: 25
Joined: Tue Nov 29, 2016 3:30 pm

Re: Updating WorkItem status + resolution via WebServices

Postby mhoe » Thu Aug 30, 2018 8:10 am

I use the Webservice .NET Wrapper. There it can be done as follows using Polarion 18:

if (workitem.resolution == null)
workitem.resolution = new TrackerWebService.EnumOptionId();
workitem.resolution.id = "done";

vincent.tancy
Posts: 2
Joined: Tue Aug 28, 2018 9:01 am

Re: Updating WorkItem status + resolution via WebServices

Postby vincent.tancy » Mon Sep 03, 2018 6:04 am

Thanks for sharing. mhoe. but i am refering to Java version.


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Google [Bot] and 3 guests