How to set artifact values using RM.Data.setAttributes
Hello,
I wright the below script and trying to set the artifact values for the attribute Priority. Below I am trying to assign '7' to Priority. It is not working.
RM.Event.subscribe(RM.Event.ARTIFACT_SELECTED, function(artifacts) {
RM.Data.getAttributes(artifacts, [RM.Data.Attributes.First,"Priority"], function(opResult) {
var attrs = opResult.data[0];
alert("Priority attribute is :" +attrs.values["Priority"]);
var priority = 7;
alert("Priority "+priority);
attrs.values["Priority"] = priority;
toSave.push(attrs);
});
RM.Data.setAttributes(toSave, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
alert("in IF Loop");
}
else
{
alert("in Else Loop");
}
});
Please tell me the what is the issue and how to set the value in artifact?