Unable to set attributes via RM API
I am trying to set attributes for a selected artifact. I am able to change the attributes without errors if the artifact is a Requirement. We have different artifact types and I cannot update their values via my script.
Here is what I am doing. This works when the selected artifact is a 'Requirement' I want to use this with a different artifact type.
M.Data.getAttributes(ref, [RM.Data.Attributes.ARTIFACT_TYPE], function(result) {
// Store any required attribute changes here
var toSave = [];
var artType = new RM.ArtifactType('TRT Requirment');
// Go through artifact data examining priority values
result.data.forEach(function(aa){
var raised = 34;
// Reuse the existing RM.ArtifactAttributes
aa.values['VerifiedCount'] = raised.toString();
toSave.push(aa);
}
});
// Perform a bulk save for all changed attributes
RM.Data.setAttributes(toSave, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
console.log('error');
}
});
});
Here is what I am doing. This works when the selected artifact is a 'Requirement' I want to use this with a different artifact type.
M.Data.getAttributes(ref, [RM.Data.Attributes.ARTIFACT_TYPE], function(result) {
// Store any required attribute changes here
var toSave = [];
var artType = new RM.ArtifactType('TRT Requirment');
// Go through artifact data examining priority values
result.data.forEach(function(aa){
var raised = 34;
// Reuse the existing RM.ArtifactAttributes
aa.values['VerifiedCount'] = raised.toString();
toSave.push(aa);
}
});
// Perform a bulk save for all changed attributes
RM.Data.setAttributes(toSave, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
console.log('error');
}
});
});