1
votes

I'm working on a .NET application to add user stories to our Rally workspace, and I'd like to set one of the user stories as a predecessor to the next one. I can add the stories just fine, but the predecessor/successor relationship isn't being created. I'm not getting any errors, it's just not creating the predecessor. (I'm using the Rally.RestApi .NET library).

I have the _ref value for the first story, and I've tried setting the "Predecessors" property on the DynamicJsonObject to that.

followUpStory["Predecessors"] = firstStoryRef;

I also tried creating a string array, no luck.

followUpStory["Predecessors"] = new string[] { firstStoryRef };

I kept the code examples to a minimum since the stories are being created fine and this is the only issue, but let me know if sharing more would be helpful.

1

1 Answers

0
votes

The easiest way is to use the AddToCollection method. Check out the docs: http://rallytools.github.io/RallyRestToolkitFor.NET/html/efed9f73-559a-3ef8-5cd7-e3039040c87d.htm

So, something like this:

DynamicJsonObject firstStory = new DynamicJsonObject(); 
firstStory["_ref"] = firstStoryRef;
List<DynamicJsonObject> predecessors = new List<DynamicJsonObject>() { firstStory};
OperationResult updateResult = restApi.AddToCollection(followUpStoryRef, "Predecessors", predecessors);