This is exactly what I was looking for and seems to work fine. Thanks.
> -----Original Message-----
> From: versionone-dev@googlegroups.com [mailto:versionone-
> dev@googlegroups.com] On Behalf Of ibuchanan
> Sent: Tuesday, April 10, 2012 12:19 PM
> To: versionone-dev@googlegroups.com
> Subject: Re: Retrieving work items with custom attributes via REST was RE:
> How to retrieve Stories and Defects in one query using Java SDK
> Will,
> It's not quite what you are doing. In my query, I had the Story and Defect
> selectors in front of the attribute name. To apply the same concept to
> your query (I bolded my change to try to make it more clear):
> $url/PrimaryWorkitem?sel=StandardProperty,Story.Custom_Story1,Defect.Custo
> m_Defect2&where=Custom_PWI_ExportFlag='yes'
> Let me know if that doesn't work for you.
> Ian
> On Tuesday, April 10, 2012 11:45:08 AM UTC-4, Saxon, Will wrote:
> Ian,
> I'm aware of this, it's what we're doing right now. The question is
> whether we can get the custom fields for both Stories and Defects (and
> Primary Work Items) in one query.
> So if I issue something like:
> $url/PrimaryWorkitem?sel=StandardProperty,Custom_Story1,Custom_Defect2&whe
> re=Custom_PWI_ExportFlag='yes'
> Where Custom_Story1 is specific to Stories, Custom_Defect2 is
> specific to Defects and Custom_PWI_ExportFlag is specific to
> PrimaryWorkitems, I get an error. I have to do this instead:
> $url/PrimaryWorkitem?sel=StandardProperty&where=Custom_PWI_ExportFlag='yes
> '
> Then for each item:
> $url/Story/$id?sel=Custom_Story1 (if it's a Story)
> $url/Defect/$id?sel=Custom_Defect1 (if it's a Defect)
> Then combine the results from the original query with the individual
> results.
> What I'm wondering is whether there is a way to issue 1 query for
> Workitem(s) and get it/them - with PWI- and Story- or Defect-specific
> custom fields - in one go.
> Sorry to hijack this thread, I should have posted separately.
> -Will
> > -----Original Message-----
> > From: versionone-dev@googlegroups.com <mailto:versionone-
> dev@googlegroups.com> [mailto:versionone-
> > dev@googlegroups.com] On Behalf Of ibuchanan
> > Sent: Tuesday, April 10, 2012 11:33 AM
> > To: versionone-dev@googlegroups.com <mailto:versionone-
> dev@googlegroups.com>
> > Subject: Re: How to retrieve Stories and Defects in one query
> using Java
> > SDK
> > Will,
> > I understand better now. You can get custom fields that are unique
> to each
> > Story and Defect using attribute selection syntax. For example:
> > https://www14.v1host.com/v1sdktesting/rest-
> <https://www14.v1host.com/v1sdktesting/rest->
> 1.v1/Data/PrimaryWorkitem?page=5,0&sel=Name,Number,AssetType,Story.Value,D
> > efect.Resolution <https://www14.v1host.com/v1sdktesting/rest-
> <https://www14.v1host.com/v1sdktesting/rest->
> 1.v1/Data/PrimaryWorkitem?page=5,0&sel=Name,Number,AssetType,Story.Value,D
> > efect.Resolution>
> > username: admin
> > password: admin
> > If you check meta, you'll notice Value is unique to Story and
> Resolution
> > is unique to Defect.
> > Hope that helps.
> > Ian
> > On Tuesday, April 10, 2012 10:54:25 AM UTC-4, Saxon, Will wrote:
> > We have a legacy defect tracking system which we want to
> auto-
> > populate w/ V1 Stories and Defects. There are item-specific
> required
> > attributes which match up with the custom fields in V1. So
> ideally, we'd
> > get all the PWIs ready for export, loop through each one, build
> the
> > corresponding legacy object, submit that and then update the V1
> item to
> > clear the export flag. Instead we're having to get all the PWIs,
> issue
> > separate queries to get the Story- or Defect-specific attributes,
> then
> > build/submit/update.
> > This is just one example. There has been discussion about
> dropping
> > the legacy system in favor of a 100% V1-based workflow, but
> anytime we
> > want to work with a backlog item that has Story- or Defect-
> specific fields
> > we have to issue two queries. Since we're using the hosted
> solution, the
> > added latency is a concern for us.
> > -Will
> > > -----Original Message-----
> > > From: versionone-dev@googlegroups.com
> <mailto:versionone-dev@googlegroups.com> <mailto:versionone-
> > dev@googlegroups.com> [mailto:versionone-
> > > dev@googlegroups.com] On Behalf Of ibuchanan
> > > Sent: Tuesday, April 10, 2012 10:23 AM
> > > To: versionone-dev@googlegroups.com <mailto:versionone-
> dev@googlegroups.com> <mailto:versionone-
> > dev@googlegroups.com>
> > > Subject: Re: How to retrieve Stories and Defects in one
> query
> > using Java
> > > SDK
> > > Will,
> > > You might be able to use downcasting. See:
> http://community.versionone.com/sdk/Documentation/DataAPI.aspx#sectio...
> <http://community.versionone.com/sdk/Documentation/DataAPI.aspx#sectio...
> t>
> <http://community.versionone.com/sdk/Documentation/DataAPI.aspx#sectio...
> <http://community.versionone.com/sdk/Documentation/DataAPI.aspx#sectio...
> > t>
> > > ribute.syntax
> > > That said, I'm not sure it will let you select on both
> Story- and
> > Defect-
> > > specific fields at once. You might need to do something
> with
> > Custom
> > > Columns. Can you explain a little more about why you
> want
> > different
> > > attributes to come back in the same query?
> > > Ian
> > > On Tuesday, April 10, 2012 9:48:43 AM UTC-4, Saxon, Will
> wrote:
> > > I have a followup question to this, because I am
> working
> > on a
> > > similar problem.
> > > I am not using the Java SDK but rather
> interfacing
> > directly w/ the
> > > API over HTTP. I have custom fields defined on
> PrimaryWorkitems,
> > Stories
> > > and Defects. If I want to get all the Stories and
> Defects with a
> > > particular PWI custom value - e.g. a 'ready for export'
> flag at
> > the PWI
> > > level - I can do that, but then I have to query each
> individual
> > PWI again
> > > to collect the Story- or Defect-specific custom field
> values. If I
> > query
> > > for PrimaryWorkitems and specify a Story- or Defect-
> specific field
> > in the
> > > 'sel=' parameter, I get an error.
> > > This makes sense, but I am wondering if there is
> a way
> > around it so
> > > that I can query 1 time for all Backlog items and get
> each one
> > with their
> > > type-specific custom fields.
> > > Thanks,
> > > -Will
> > > > -----Original Message-----
> > > > From: versionone-dev@googlegroups.com
> <mailto:versionone-dev@googlegroups.com>
> > <mailto:versionone-dev@googlegroups.com <mailto:versionone-
> dev@googlegroups.com> > <mailto:versionone-
> > > dev@googlegroups.com> [mailto:versionone-
> > > > dev@googlegroups.com] On Behalf Of ibuchanan
> > > > Sent: Tuesday, April 10, 2012 9:13 AM
> > > > To: versionone-dev@googlegroups.com
> <mailto:versionone-dev@googlegroups.com> <mailto:versionone-
> > dev@googlegroups.com> <mailto:versionone-
> > > dev@googlegroups.com>
> > > > Subject: Re: How to retrieve Stories and
> Defects in one
> > query
> > > using Java
> > > > SDK
> > > > Anjum,
> > > > The trick is that both Stories and Defects are
> > PrimaryWorkitems.
> > > You
> > > > didn't mention which layer of the SDK you are
> using (API
> > Client or
> > > Object
> > > > Model).
> > > > Assuming API Client, you can follow the
> approach to get
> > multiple
> > > assets:
> http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> l>
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> > l>
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> <http://community.versionone.com/sdk/DetailedDocumentation/SDK%20.Net/...
> > > l>
> > > > ient/apiclient.html#query.assets
> > > > Just change the asset type to PrimaryWorkitem:
> > > > IAssetType storyType =
> > metaModel.GetAssetType("PrimaryWorkitem");
> > > > (Note: ideally, you also rename the variable
> to
> > > primaryWorkitemType but
> > > > the above makes it simple for copy/paste.)
> > > > Yours truly,
> > > > Ian Buchanan
> > > > Product Manager for Platform and Integrations
> > > > On Tuesday, April 10, 2012 8:46:13 AM UTC-4,
> Anjum
> > Naseer wrote:
> > > > Hi,
...