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?
Accepted answer
Have a look at How to get the Artifact Type using the DOORS Javascript
This may answer your question.
Peter
2 other answers
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.