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

How can we use RDNG Extensions API to detemine the artifact type of the currently selected artifact?

We came across the latest RM Extensibility feature in CLM 5.0. We are trying to use the RM API to use customize a RRC widget  to determine the artifact type of the currently selected artifact. The code makes use of the ARTIFACT_TYPE constant.:

RM.Data.getAttributes(attrRef, function(attrResult) {


  if (attrResult.code != RM.OperationResult.OPERATION_OK){
   return;
  }

var attrs = attrResult.data[0];

document.getElementById("artifactType").innerHTML ="Artifact type  obtained : "+attrs.values[RM.Data.Attributes.ARTIFACT_TYPE];

}

On artifact selection the Artifact type appears as : Undefined.

Is any change required in the code?

1

0 votes


Accepted answer

Permanent link
Hi,

Have a look at How to get the Artifact Type using the DOORS Javascript

This may answer your question.

Peter

Achla Sharma selected this answer as the correct answer

0 votes


2 other answers

Permanent link
I hope this is just a simple mistake since we can only see so little of the code - the parameter passed into the function is "attrResult" but it is not used when referencing the ARTIFACT_TYPE constant and a variable "attrs" is used instead. I suppose "attrs" should have been "attrResult".

0 votes

Comments

Hi Donald,

The "attrs" variable here refers to :
var attrs = attrResult.data[0];

I also tried adding the following snippet :
var documentType = new RM.ArtifactType('Document');
var refType = attrs.values[RM.Data.Attributes.ARTIFACT_TYPE];
        if(refType.equals(documentType))
        {
        // do some operation
        }

The equals operation throws an undefined type error.


Permanent link
 Hi,

Sorry for the slow response.  I cannot see any reason why the code you posted would produce undefined.  Can you see by printing to the browser console what the "attrs" object is ?

Thanks,
Steve Wood.

DOORS Next Generation team.


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: Dec 05 '14, 9:01 a.m.

Question was seen: 4,831 times

Last updated: Jan 13 '15, 1:15 a.m.

Confirmation Cancel Confirm