Rally Software

Expand all | Collapse all

Pulling Release information from Rally Production environment using .NET Custom code.

  • 1.  Pulling Release information from Rally Production environment using .NET Custom code.

    Posted 02-23-2018 08:31 AM

    I am using below lines of code for pulling "Release Details" from Rally Prod enviorment, but it is returning zero resulsts
    even I have data available.

    When pointing same code to Development, it is returning requested query results. Please help me in this.

     

    Request request = new Request("release");

    request.Query = new Query("Name", Query.Operator.Equals, releaseName);

    // Make request and process results
    QueryResult queryResult = restApi.Query(request);
    foreach (var releaseData in queryResult.Results)
    {
    releaseEndDate = releaseData["ReleaseDate"];
    releaseStartDate = releaseData["ReleaseStartDate"];
    }



  • 2.  Re:  Pulling Release information from Rally Production environment using .NET Custom code.

    Posted 02-23-2018 04:22 PM

    There's not enough code here for me to really sink my teeth into.  I would hazard some guesses:

    1. Look at the fields you are Fetching and make sure Name, Release Date and Release Start Date are included

    2. Look at how "releaseName" is defined - make sure it is spelled correctly for the environment you are in.

    3. Did your Authentication succeed?

    4. You may have to use _refObjName (something like that, can't remember exact name) instead of "Name"

     

    Anything else I would say would be total conjecture since there's not really enough code to look at.



  • 3.  Re:  Pulling Release information from Rally Production environment using .NET Custom code.

    Posted 02-27-2018 08:34 AM

    Thank you for Dan for the useful information.

    I have executed all above mentioned things, but no luck. 

    I like share "Release" details of both the Workspace/Environments/Subscriptions (DEV and Sandbox).

    I have also shared complete code. Please look into this.

     

    DEV - Environments/WorkSpace: Release info

     

    {

    "Release":

    {"_rallyAPIMajor": "2",
    "_rallyAPIMinor": "0",
    "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/release/65248042552",
    "_refObjectUUID": "752d2dbe-6ab0-4c40-aaf9-607d7d479189",
    "_objectVersion": "2",
    "_refObjectName": "Q3 - TEST Release DFS 2016",
    "CreationDate": "2016-09-26T12:00:36.621Z",
    "_CreatedAt": "Sep 26, 2016",
    "ObjectID": 65248042552,
    "ObjectUUID": "752d2dbe-6ab0-4c40-aaf9-607d7d479189",
    "VersionId": "2",


    "Subscription": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/subscription/16838490087", "_refObjectUUID": "63a79a0d-bf44-4c86-b896-5555632b30e3", "_refObjectName": "Discover Financial Services- IL", "_type": "Subscription"},


    "Workspace": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/51208342371", "_refObjectUUID": "a5d4ad80-1664-47ab-9469-916c0f6333ba", "_refObjectName": "DFS Development Workspace", "_type": "Workspace"},

    "Accepted": null, "GrossEstimateConversionRatio": 1.0, "Name": "Q3 - TEST Release DFS 2016", "Notes": "", "PlanEstimate": null, "PlannedVelocity": null,

    "Project": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/project/51409689721", "_refObjectUUID": "2973c98a-9bf8-49db-a2b4-ec5fb1de509c", "_refObjectName": "Team EPMO - Development", "_type": "Project"},


    "ReleaseDate": "2016-10-06T04:59:59.000Z", "ReleaseStartDate": "2016-09-27T05:00:00.000Z",

    "RevisionHistory": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/revisionhistory/65248042560", "_refObjectUUID": "8d0f2d4d-6c85-4653-8e8c-6782ec3f69ef", "_type": "RevisionHistory"},

    "State": "Planning", "TaskActualTotal": null, "TaskEstimateTotal": null, "TaskRemainingTotal": null, "Theme": "", "Version": null, "Errors": [], "Warnings": []}

    }

     

     

    Sandbox- Environments/WorkSpace: Release info

     

    {

    "Release":

    {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/release/128790471648", "_refObjectUUID": "f72251c8-ba02-4d94-8ce7-3b0ec52a2a06", "_objectVersion": "1", "_refObjectName": "July R Test", "CreationDate": "2017-06-22T13:55:53.283Z", "_CreatedAt": "Jun 22, 2017", "ObjectID": 128790471648, "ObjectUUID": "f72251c8-ba02-4d94-8ce7-3b0ec52a2a06", "VersionId": "1",


    "Subscription": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/subscription/16838490087", "_refObjectUUID": "63a79a0d-bf44-4c86-b896-5555632b30e3", "_refObjectName": "Discover Financial Services- IL", "_type": "Subscription"},


    "Workspace": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/17108262889", "_refObjectUUID": "e0ee91d7-73bb-4e9a-81f1-d7c08ba62c25", "_refObjectName": "DFS Sandbox", "_type": "Workspace"},

    "Accepted": 13.0, "GrossEstimateConversionRatio": 1.0, "Name": "July R Test", "Notes": "", "PlanEstimate": 13.0, "PlannedVelocity": 40.0,

    "Project": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/project/112250541604", "_refObjectUUID": "30751a63-ddfc-4129-b2e7-16bdedc33305", "_refObjectName": "CDS Team", "_type": "Project"},


    "ReleaseDate": "2017-08-01T04:59:59.000Z", "ReleaseStartDate": "2017-07-01T05:00:00.000Z",


    "RevisionHistory": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/revisionhistory/128790471656", "_refObjectUUID": "69b4338f-104d-4e73-b0f5-6657066b37c8", "_type": "RevisionHistory"},


    "State": "Planning", "TaskActualTotal": 0.0, "TaskEstimateTotal": 0.0, "TaskRemainingTotal": 0.0, "Theme": "", "Version": null, "Errors": [], "Warnings": []}


    }

     

    Code:

     

    internal StringBuilder DisplayFeatureInformation(QueryResult portfolioItems, RallyRestApi restApi)
    {

    // Feature
    string featureID = null;
    string featureName = null;
    string rallyProjectName = null;
    string featureOwner = null;
    string initiativeID = null;
    string initiativeName = null;
    string State = null;
    int preliminaryEstimate = 0;
    string investmentCategory = null;
    int valueScore = 0;
    int riskScore = 0;
    decimal WSJFScore = 0;
    int refinedEstimate = 0;
    string releaseName = null;
    string releaseStartDate = null;
    string releaseEndDate = null;
    string plannedStartDate = null;
    string plannedEndDate = null;
    string actualStartDate = null;
    string actualEndDate = null;
    string deploymentDate = null;
    int userStoryCount = 0;


    var sbFeature = new StringBuilder();

    sbFeature.AppendFormat
    ("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17} , {18}"


    , "FeatureID", "Feature Name", "Project Name"
    , "Feature Owner", "initiativeID", "initiative Name", "State"
    , "Priliminary Estimate ", "Investment Category"
    , "Value Score", "Risk Score"
    , "WSJF Score", "Refined Estimate"
    // , "Release Name", "Release start Date", "Release End Date"
    , "Planned Start Date", "Planned End Date"
    , "Actual Start Date", "Actual End Date"
    , "Deployment Date", "# of Stories"

    );

    sbFeature.AppendLine();

    Console.Write("\n------------------------------------------------------------------------------");
    foreach (var feature in portfolioItems.Results)
    {

    // Feature Details
    featureID = feature["FormattedID"];
    featureName = feature["_refObjectName"];
    if (featureName.Contains(','))
    {
    featureName = featureName.Replace(',', ' ');
    }
    //Rally Team/Project Name
    if (feature["Project"] != null)
    {
    rallyProjectName = feature["Project"]["_refObjectName"];
    }


    if (feature["Owner"] != null)
    {
    featureOwner = feature["Owner"]["_refObjectName"];
    }

    //Initiave
    if (feature["Parent"] != null)
    {
    initiativeID = feature["Parent"]["FormattedID"];
    initiativeName = feature["Parent"]["_refObjectName"];

    if (initiativeName.Contains(','))
    {
    initiativeName = initiativeName.Replace(',', ' ');
    }

    }
    if (feature["State"] != null)
    {
    State = feature["State"]["_refObjectName"];

    }
    //preliminaryEstimate
    if (feature["PreliminaryEstimateValue"] != null)
    {
    preliminaryEstimate = feature["PreliminaryEstimateValue"];

    }
    //investmentCategory
    if (feature["InvestmentCategory"] != null)
    {
    investmentCategory = feature["InvestmentCategory"];

    }
    //valueScore
    valueScore = feature["ValueScore"];
    riskScore = feature["RiskScore"];
    WSJFScore = feature["WSJFScore"];
    //refinedEstimate RefinedEstimate
    refinedEstimate = feature["RefinedEstimate"];

    // if (feature["ActualEndDate"] != null)
    // {
    //actualEndDate = feature["ActualEndDate"];
    if (feature["Release"] != null)
    {
    releaseName = feature["Release"]["_refObjectName"];
    if (releaseName.Contains(','))
    {
    //releaseName = releaseName.Replace(',', ' ');
    }
    Request request = new Request("release");

    request.Query = new Query("ObjectID", Query.Operator.Equals, "65248042552");

    // Make request and process results
    QueryResult queryResult = restApi.Query(request);
    foreach (var releaseData in queryResult.Results)
    {
    releaseEndDate = releaseData["ReleaseDate"];
    releaseStartDate = releaseData["ReleaseStartDate"];
    }
    }
    // }
    if (feature["PlannedStartDate"] != null)
    {
    plannedStartDate = feature["PlannedStartDate"];

    }
    if (feature["PlannedEndDate"] != null)
    {
    plannedEndDate = feature["PlannedEndDate"];

    }
    if (feature["ActualStartDate"] != null)
    {
    actualStartDate = feature["ActualStartDate"];

    }

    //deploymentDate
    if (feature["c_DeploymentDate"] != null)
    {
    deploymentDate = feature["c_DeploymentDate"];

    }
    //userStoryCount
    if (feature["UserStories"]["Count"] != null)
    {
    userStoryCount = feature["UserStories"]["Count"];

    }

     

    sbFeature.AppendFormat
    ("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17} , {18}"


    , featureID, featureName, rallyProjectName
    , featureOwner, initiativeID, initiativeName, State
    , preliminaryEstimate, investmentCategory
    , valueScore, riskScore, WSJFScore, refinedEstimate
    //, releaseName, releaseStartDate, releaseEndDate
    , plannedStartDate, plannedEndDate, actualStartDate, actualEndDate
    , deploymentDate, userStoryCount

     

    );
    sbFeature.AppendLine();
    }

    return sbFeature;
    }



  • 4.  Re:  Pulling Release information from Rally Production environment using .NET Custom code.

    Posted 02-27-2018 09:18 AM

    Yerroju,

     

    Are you always using this query?

     

    request.Query = new Query("ObjectID", Query.Operator.Equals, "65248042552");

     

    If so, you are hardcoding your Release ObjectID from the Development Environment.  It isn't valid in any other Workspace, so the query will return zero results in any other Workspace.



  • 5.  Re:  Pulling Release information from Rally Production environment using .NET Custom code.

    Posted 02-28-2018 03:45 AM

    No I am not using it, I have kept this for testing results.

    It should be like below in the code. Please look into it.

    request.Query = new Query("Name", Query.Operator.Equals, "releaseName");

     



  • 6.  Re:  Pulling Release information from Rally Production environment using .NET Custom code.

    Posted 02-28-2018 04:23 AM

    Yerroju,

     

    OK.  My next guess is that the Release does not exist in the default Workspace/Project you have set in your profile, or if you do not have a default Workspace/Project set in your profile then the Release does not exist in the first Workspace alphabetically in your Subscription that you have been given access.

     

    If you scope the request to the appropriate Workspace, does that help?

     

    You may do this by adding this to your code where you are querying for the Release.

     

    request.Workspace = "workspace/17108262889";  // The Reference to the Workspace.

     

    There is some further information about Workspace/Project scoping and using Web Services in this KB Article: How workspace scoping in the UI affects workspace - CA Knowledge 

     

    Michael