Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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)');
        }
    });
    });   
}

1 vote



One answer

Permanent link
The artifact type is "read-only" when using the client extension API. The document will be updated to state this clearly.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jan 16 '15, 12:48 a.m.

Question was seen: 4,259 times

Last updated: Feb 08 '15, 7:47 p.m.

Confirmation Cancel Confirm