Rally Software

Expand all | Collapse all

Update PARENT field of Item FEATURE with Initiative reference

Jump to Best Answer
  • 1.  Update PARENT field of Item FEATURE with Initiative reference

    Posted 05-26-2020 07:55 PM

    I am using the 'chooser below' to get some values out of an Initiative (The chooser displays Features and Team Features too but I will select the Initiative)

     FormattedID, Name, Owner and DisplayColor

     Have been trying to add "Parent" to the Columns but cannot seem to do it

     Code extract: 

            Ext.create('Rally.ui.dialog.ArtifactChooserDialog', {

            artifactTypes: ['PortfolioItem'],

            autoShow: true,

            columns : ['FormattedID', 'Name', 'Owner' , 'DisplayColor' ],  

            width : 800,

     I get the values using

     Code Extract

     listeners: {

    artifactChosen: function(dialog, selectedRecord){

                    //    this.down("#item-label2").setText(selectedRecord.get('FormattedID') + ' - ' + selectedRecord.get('Name'));

                        this.down("#item-label2").setText(selectedRecord.get('Name'));

    projectFID=selectedRecord.get('FormattedID');

    projectName=selectedRecord.get('Name');

    projectOwner=selectedRecord.get('Owner')._ref;

    artifactColor=selectedRecord.get('DisplayColor');

     

    I noticed that I can only .get the field that I have listed in the "Columns" above

    The "Owner" was a little tricky and after some time realized that I needed to use the "._ref"

    I was hoping that I would need to do the same for FormattedID but it does not work

     My end aim is to update the Parent Field of a Feature with the reference of the chosen Initiative using code below

     Code Extract:

     rec.set("Project",app.projectRef);

     rec.set("Name", projectName + newName);

     rec.set("Owner",projectOwner);

     rec.set("DisplayColor",artifactColor);

     //If the itemType is set to I, then this first item must be Feature so add the INIT FID as the parent

     if (itemType=="I") {

        rec.set("Parent",projectFID._ref);

     }

     I know the "Parent" Field is an object and as such will not accept just text

     I have had a look for properties for Parent and FormattedID to get an idea of how to do this but to no avail

    Basically, what I am trying to do is

    • Select an Initiative
    • Update the next Feature's Parent field with the reference of the first Initiative

     Of course, I could be way off target

     All suggestions welcome

     Thank You

    Chas



  • 2.  RE: Update PARENT field of Item FEATURE with Initiative reference
    Best Answer

    Posted 05-27-2020 08:20 AM
    Hi @Chas Chand, Unfortunately, I am unclear as to what your question is here. If it is a general 'help, how do I set a parent of a feature', then setting the Parent field of the child to the _ref​​ of the parent is generally how I would approach it.

    I just made this repo public (something I was playing about with a while ago), have a look at this line and what it does: https://github.com/nikantonelli/CopyTree/blob/16d4cedd0423559ff894a8fcf455fd9b12e74625/App.js#L920


    ------------------------------
    Nik
    Ask me a question, I'm All Ears!
    Rally Sales Engineer
    Rally Software
    ------------------------------



  • 3.  RE: Update PARENT field of Item FEATURE with Initiative reference

    Posted 05-27-2020 08:49 AM
    Hello @Nik Antonelli

    I will read your link shortly but just to clarify, yes it is a general question

    I am trying to retrieve information from Initiative (eg I4729) and update its child Feature eg (F36616) with the Parent Information retrieved from I-4729)

    What would I retrieve (fetch) from I4729 and how would I update the parent field of F36616

    With text fields it has been easy by just reading the filed (ie .get('name') and when adding it to F36616 by .set('name') but this is not working for PArent

    I have tried setting the Parent Field (of the Feature) with FormattedID of the Initiative - not working

    I will read your link

    Thanks

    Chas​


  • 4.  RE: Update PARENT field of Item FEATURE with Initiative reference

    Posted 05-27-2020 03:44 PM
    Hello @Nik Antonelli
    I read your link but may be too involved fro what I need.  I am modifying an existing program (Portfolio Item copy) to change certain fields whilst copying item​

    I have most of what I want done completed

    I can Successfully write
    Modified "Name" to new 'copied' Item (Feature)
    Modified "Description" to the new copied item (Feature)
    and so on for text fields

    What I cant do is update the Parent field of the new copied item (Feature)

    I have a variable holding the Parent Initiative number as text (I4729) in a variable (ParentID) but the new copied item (Feature) will not accept it as I believe the variable "ParentID" is a text field and the new item's (Feature's) Parent field is an Object.

    If I was to be successful in updating the Parent field, it would be I4729 : Initiative Name

    Some thoughts
    1) Is there a way of making the ParentID variable an object ?
    2) Should I try concatenating ParentID + ":" + Initiative Name before writing it to the new copied item "Parent" field

    I'm clutching at straws now really !!

    Regards

    Chas

    I




  • 5.  RE: Update PARENT field of Item FEATURE with Initiative reference

    Posted 05-27-2020 08:08 PM
    Hello @Nik Antonelli

    Don't look into this any more Nik

    I have cracked it  !!

    To update the Parent field, You have to use the ObjectID

    (This one line of code that was needed had me stumped for a couple of days)

    Thanks for your earlier replies and thoughts

    Regards

    Chas​​