It's all about the answers!

Ask a question

Widget implementation in Jazz DNG


Tiberius Opitz (1314) | asked Mar 29 '17, 11:38 a.m.

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

Be the first one to answer this question!


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.