Setting a Feature on User Story in UI and WS API

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


A user states that they are not able set Feature to a user story: there is no "Feature" field or a tab on User Story editable details page.




To set Feature in the UI:

Click on Parent dropdown on User Story's editable details page:

User-added image

Parent field allows selection of either another User Story as a parent (epic) or a Feature:

User-added image

Select a feature from the list:

User-added image

Now the Feature is visible in the Parent field on the editable details page:

User-added image

If you are using an older version of the User Story page (have not switched to the new one yet) the UI is slightly different and the Feature is referred to as "Portfolio Item Feature", but it is the same object type and the same functionality:

User-added image

To set Feature in via Web Services API:

The steps in the UI may create a wrong expectation that to set a Feature on a User Story, a Parent attribute of a HierarchicalRequriement object has to be set. However, in the UI the "Parent" field has a more general, casual meaning.

In WS API? Parent field on a Hierarchical Requirement(a.k.a. user story) is expected to be another Hierarchical Requirement. It cannot be a Feature. Also, Feature field on a story is read-only, and UserStories collection on Feature is read-only. That leaves us with the option to update PortfolioItem field on a story.

Per WS API object model a HierarchiclaRequirement object has Parent attribute that points to another HierarchiclaRequirement (a Parent story), a Feature attribute that references PI/Feature object that could be either its direct PI/Feature parent or the parent of it's parent user story, and a PortfolioItem attribute that points to its immediate PI/Feature parent.

Here is a screenshot from WS API object model:

User-added image

For example, if we have US1 parent story and US2 child story, and the PI/Feature "parent" of US1 is F1,? this query:
(PortfolioItem.FormattedID = F1)
returns US1 that has a parent Feature. It does not return US2.
and this query:
(Feature.FormattedID = F1)
returns both the epic and it's child, US1 and US2.

Here is a Ruby example based on CA Agile Central Ruby REST Toolkit that set's Feature on a User Story. Regardless of your choice of language or a toolkit, your code should follow the same idea, since it is working within the same WS API:
require 'rally_api'

#Setup custom app information
headers = = "My Utility"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

# Connection to CA Agile Central
config = {:base_url => ""}
config[:username] = ""
config[:password] = "secret"
config[:workspace] = "W1"
config[:project] = "P1"
config[:headers] = headers #from

@rally =

obj = {}
obj["Name"] = "new story efd"
new_s = @rally.create("hierarchicalrequirement", obj)

query =
query.type = "portfolioitem"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "" } 
query.project = {"_ref" => "" } 
query.query_string = "(FormattedID = \"F22\")"

result = @rally.find(query)
feature = result.first

field_updates={"PortfolioItem" => feature}