queryWorkItems() with custom field

Description
scottyseus
Posts: 7
Joined: Thu Jul 11, 2013 7:07 pm
Location: Seattle, WA, USA

queryWorkItems() with custom field

Postby scottyseus » Mon Jul 29, 2013 11:16 pm

Hi all,

I have not been able to figure out how to use the queryWorkItems() method with a custom field.

Here is what I have for the method so far:

Code: Select all

private String[] fields = {"workRecords", "project"};
WorkItem[] items;
items = trackerService.queryWorkItems("project.id:sandbox AND workRecords.user.id:" + user.getId(), "project", fields);


This works fine. However, we have a custom field with ID 'billing_code' that I am trying to query for, but this does not work:

Code: Select all

private String[] fields = {"workRecords", "project", "billing_code"};


and the variations that I have tried do not work either. Does anyone know how to do this?

also, the billing_code custom field is only available in the 'sandbox' project, which I specify in the query.

Thanks,
Scott

scottyseus
Posts: 7
Joined: Thu Jul 11, 2013 7:07 pm
Location: Seattle, WA, USA

Re: queryWorkItems() with custom field

Postby scottyseus » Tue Jul 30, 2013 5:15 pm

So I have fixed this particular issue.

instead of

Code: Select all

private String[] fields = {"workRecords", "project", "billing_code"};


I used

Code: Select all

private String[] fields = {"workRecords", "project", "customFields"};


However, the method WorkItem.getCustomFields() keeps returning null despite the fact that I know I have populated work items with our custom fields.

Any tips?

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

Re: queryWorkItems() with custom field

Postby NickEntin » Wed Jul 31, 2013 6:13 am

Hi,

first of all, please be more specific - I guess you're speaking about WebServices access to Polarion.

For this case, I think what you're looking for is
trackerService.getCustomField(workitemURI, customFieldID)

and

trackerService.getCustomFieldKeys(workitemURI)

Best regards,
Nick

mosaad
Posts: 3
Joined: Mon Feb 10, 2014 12:27 pm

Re: queryWorkItems() with custom field

Postby mosaad » Mon Feb 10, 2014 12:31 pm

This is how you could get the query to return custom fields in a workitem add to the fields list

Code: Select all

private String[] fields = {"workRecords", "project", "customFields.idoftheCustomFieldYouNeed"};


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], ko2, od1 and 13 guests