Does Web Servicse API use Name or DisplayName of custom fields?

Document ID : KB000057512
Last Modified Date : 14/02/2018
Show Technical Document Details

Resolution

WS API is using Display Name and not Name of custom fields. To be exact it is using? Display Name that is camel-cased with the first letter also capitalized and with no spaces.

In this example a custom field is created on a PortfolioItem object:

User-added image

We set a value of this custom field for a random PortfoilItem/Feature to 2 and run this query that uses Name:

User-added image

The query returns 0 results.

Next, we use DisplayName in the query:

User-added image

The query returns the PortfolioItem/Feature where the custom field in question was set to 2.

When querying for custom fields use DispalyName of the field (camel-cased and without spaces) instead of Name.

Note about v2.0 of WS API: These queries were made with v2.0 of WS API even though in WS API custom fields are referenced with c_ prepended. The following does not apply to versions of WS API prior to v2.0.
This is how the field is shown in WS API document:

User-added image

Let?s query the same PortfolioItem/Feature while fetching full object and examine the result to verify that this custom field is referenced in the result as c_SizeOfJob

User-added image

A special case of queries in the custom grid when custom field names contain dashes and underscores:

We recommend that custom field names do not use underscores or dashes.

In this example however the custom field has underscores in both the Name and the Display Name to demonstrate that this may cause a discrepancy between the results in WS API queries run directly in the WS API interactive document, and the queries run in custom grids inside Rally tool:

Name: Custom_String
Display Name: Custom_String


While this query in the interactive WS API documentation

(Custom_String = "abc")

will return expected result:

{
QueryResult: {
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
Errors: [ ],
Warnings: [ ],
TotalResultCount: 1,
StartIndex: 1,
PageSize: 20,
Results: [
{
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
_ref: "https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/19075422526",
_refObjectUUID: "4ee13515-eba4-4306-a814-d01a69f0e890",
_refObjectName: "s1",
_type: "HierarchicalRequirement"
}
]
}
}


the same query in a custom grid will return an error:

Could not parse: Could not find attribute "Custom_String" on type HierarchicalRequirement in the query segment "Custom_String"

If the underscore in the grid's settings query box is removed:

(CustomString = "abc")

it returns correct results even though the actual field's name has not been changed.

To continue with this example,? a workspace administrator changes Display Name of this custom field:

Name: Custom_String
Display Name: Custom String


Now this query works in the grid:

(CustomString = "abc")

To illustrate further that the Display Name (and not the Name) is used in queries,? the Name is changed by the workspace administrator to Custom_String-foo

Name:Custom_String-foo
Display Name: Custom String


but the query (CustomString = "abc") still returns expected results in the custom grid.