Questions & Answers

Get your Rally questions answered.

This is a public Hive  publicRSS

Question

    How can I get the story that is associated with a defect?
    Question posted Feb 02 by Saskia Band , tagged Integrations, Web Services API
    2046 Views, 1 Comment
    Title:
    How can I get the story that is associated with a defect?
    Summary:

    What's the best way to get to the attributes of the Story to which a Defect is linked.

    IE. defects[0].story.source

    Full Description:

    I'm using the Rally API from Ruby to generate a report. We have a custom field on Story called "Source", which determines the source type of Story (eg. Prod Issue, Enhancement, etc).

    I'd like to be able to group all Stories and Defects that are of Source type "Enhancement". I haven't been able to work out how to access the Story attributes from the Defect object. I've only managed to get Defect.Requirement but I don't seem to be able to get anything from Requirement.

    Any assistance would be appreciated.

    Comments

    • posted Feb 03 by N.Musaelian

      Hi Saskia,

      This is how you can get to a custom filed 'source' from requirement:

      defect.requirement.source

      I tested it with the following block of code:

      #start block

      all_defects = $rally.find_all(:defect, :workspace=> $rally_workspace, :project=>$rally_project, :project_scope_up=>false, :project_scope_down=>false, :fetch=>true) 

      all_defects.each do |defect|

      puts defect.requirement.source

      #end block

       - Nick

      Reply to this Comment