It's all about the answers!

Ask a question

Unable to set attributes via RM API


Pooja Srivastava (3011518) | asked Mar 12 '15, 2:53 p.m.
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');
        }
          });
   });   

One answer



permanent link
Dominic Tulley (38114) | answered Mar 30 '15, 5:05 a.m.
 Hi Pooja,
on the artifact you are trying to modify, does the artifact type include the VerifiedCount attribute?
You don't describe the manner in which this script fails.  Does the setAttributes call return success or failure and, if it's a failure, what is the message?
thanks,
-Dominic

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.