Widget implementation in Jazz DNG

I want to implement a widget, that can change the Artifact type of an selected artifact. I thought, that i can do with the setAttribute method. But unfortunately the changes will not be made but also no error will be reported.
Here the piece of code I tried to do the change:
RM.Data.getAttributes(row.ref, [ RM.Data.Attributes.IDENTIFIER,
RM.Data.Attributes.ARTIFACT_TYPE,
typeAttributeName
], function(opResult) {
if(opResult.code == RM.OperationResult.OPERATION_OK) {
var rowToChange = opResult.data[0];
RM.Client.setSelection(rowToChange.ref);
var artType = new RM.ArtifactType(attrType);
rowToChange.values[RM.Data.Attributes.ARTIFACT_TYPE] = artType;
// save change in the row
RM.Data.setAttributes(rowToChange, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
// error handling code here
console.log(result);
$("#errorlist").append("<div class=\"error-entry\">Save was not successful.(ID: " + row.values[RM.Data.Attributes.IDENTIFIER] + ")</div>");
}
});
} else {
$("#errorlist").append("<div class=\"error-entry\">Load artifact attributes for save was not successful.(ID: " + row.values[RM.Data.Attributes.IDENTIFIER] + ")</div>");
}
});