So, I made a model for a changeset, get a changeset with 2 artifacts and fetch the Artifacts field. When I console log that, I get two items. I have another item ( a task ) that I push into this field. When I console log the artifacts array, I get three items.
But then when I set the field, either directly or using set(), I console log the changeset and it still only thinks there are two artifacts. What might I be doing wrong?
Rally.data.ModelFactory.getModel({
type: 'Changeset',
success: function(model) {
model.load( '1234', {
fetch: [ 'Artifacts' ],
callback: function(result, operation) {
if ( operation.wasSuccessful() ){
var artifacts = result.get('Artifacts');
if ( ! artifacts ) {
artifacts = [];
}
artifacts.push( item );
console.log( artifacts );
result.data.Artifacts = artifacts;
//result.set('Artifacts', artifacts);
console.log( result );
result.save( {
callback: function( result, operation ) {
console.log( "After saving: ", operation );
}
} );
}
}
})
}
});
This was fixed with a SaaS release over the weekend. One can now send an array of artifacts and that array replaces the original list, like other arrays in the WSAPI.