How to query custom fields for empty values in Web Services API
Document ID :
Last Modified Date :
Show Technical Document Details
CA Agile Central
CA Agile Central On-Premises
AGILE CENTRAL SAAS:ACSAAS
AGILE CENTRAL ON PREMISES:ACPREM
In the context of running integrations with third party tools, it is a common practice to create a custom field of type String in Rally designated to hold an ID of corresponding artifact from another system. Unlike WebLink type of fields, String type fields are queriable, and it is often desirable to query those fields for empty or non empty values to confirm what is being filtered in or out by integrations.
1. Determine the type of the custom field. When a custom field is created by an administrator, the field type is set, and cannot be modified later. Here is a screenshot from Setup>Workspaces & Projects, accessible to users with administrator rights:
2. WS API v2.0 references custom fields with c_ prefix.
Login to Rally and go to the Workspace where this custom field exists.
In another tab of the same browser go to
WS API documentation
Scroll the frame on the left to the ObjectModel section.
Keep scrolling to find the Object on which this custom field exists. Let's assume it is a Defect. Click on Defect.
On the right (main) frame Defect's object details are shown. Scroll this frame to look for attributes of Defects, specifically those starting with c_
for example, c_QCID
Make a note how it is referenced.
3.Query directly in the WS API. For example,
(c_QCID != "")
should return all artifacts where there is a value in the field, and
(c_QCID = "")
should return all artifacts where the field is empty assuming this is a custom field of type String.
I assume this is related to your QC integration, but I limit my answer to the WS API side of things, however, the connector setup requires the field to be a String.
Some languages will expect double quotes to be escaped when querying on an empty string in a application. For example, a Java application based on
Rally Java RESET Toolkit
will return artifacts with empty custom field when double quotes are escaped as shown in this
new QueryFilter("c_QCID", "=", "\"\"")
Regardless of the toolkit or language preference, a direct query in the WS API will help to determine what to expect even before any custom code is written. Here is a direct endpoint to? try in the browser after a valid workspace OID replaces 1111? and the valid? custom field name replaces
https://rally1.rallydev.com/slm/webservice/v2.0/defect?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111&query=(c_QCID != "")&fetch=c_QCID&
Was this information helpful?