1

Can somebody give me an example of how to add a tag to a defect using the Rally App SDK (in Javascript)?

Updating simple fields are straightforward, but I'm not clear how to attach list of objects to other objects (e.g. tags to defects).

Thanks...

kimon
  • 2,481
  • 2
  • 23
  • 33

1 Answers1

1

Any object in Rally can be uniquely identified by its _ref property. So if you want to set the tags on a defect you can simply do so like this:

rallyDataSource.update({"_ref":
    "https://rally1.rallydev.com/slm/webservice/1.26/defect/12345.js",  //defect to update
    "Tags": [
        {
            _ref: "/tag/23456.js" //ref of tag 1
        }, 
        {
            _ref: "/tag/34567.js"  //ref of tag 2
        }
    ]}, 
    onUpdateComplete, onError);  //success, error callbacks
Kyle Morse
  • 8,390
  • 2
  • 15
  • 16
  • Seems straightforward, and when I code this up with valid OID's, the the success function is called, but in fact it removed the one tag that was already on the defect in question, but did not add the other two I put in the "Tags" array. But the code is just as you suggested...not sure why its not working – kimon Feb 17 '12 at 05:15
  • Sorry- I missed a level of nesting in the Tags array. The tags should be specified as objects with a _ref property instead of just the refs. I've updated the code example and it should work for you now. – Kyle Morse Feb 17 '12 at 20:12