How do you change the Artifact Type property value using the API?
Hi everyone,
I am trying to change the artifact type using the API, my code is below. I am unable to follow the example procedure shown in the wiki (https://jazz.net/wiki/bin/view/Main/RMExtensionsAPI502#SetAttributes) because the getAttributes function does not include the ARTIFACT_TYPE in 'result.data' and therefore I cannot just change the attribute as per the example. When I execute my code, it runs without breaking but does not change the ARTIFACT_TYPE value in the artifact so I am suspicious of the setAttributes function. Is it possible to do this using setAttributes function, have I made a mistake in my code or is there another way of executing this task? Thanks in advance, Andrew code: function changeArtifactType() { //Get the Artifact Type attribute RM.Data.getAttributes(selectedArtifact, [RM.Data.Attributes.ARTIFACT_TYPE], function(attrResult) { if (attrResult.code != RM.OperationResult.OPERATION_OK) { alert('getAttributes failed in the changeArtifactType function'); return; } artifactTypeAttribute = attrResult.data[0]; // Store any required attribute changes here var toSave = []; //Change the Artifact Type attribute value artifactTypeAttribute.values[RM.Data.Attributes.ARTIFACT_TYPE].name = 'Requirement'; toSave.push(artifactTypeAttribute); // Perform a bulk save changed attributes RM.Data.setAttributes(toSave, function(result) { if(result.code !== RM.OperationResult.OPERATION_OK) { alert('Error in the change artifact type function)'); } }); }); } |
One answer
The artifact type is "read-only" when using the client extension API. The document will be updated to state this clearly.
|
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.