It's all about the answers!

Ask a question

How do I get the Attribute Type using the Doors Javascript API


0
1
Andrew Lloyd (5346) | asked Jan 12 '15, 11:23 p.m.
Using the Attributes and Links example extension, I am not able to display the Artifact Type. Is there a way to get this value using the API?
I have tried using the line,

attrs.values[RM.Data.Attributes.ARTIFACT_TYPE];

as per a similar question (https://jazz.net/forum/questions/169582/how-can-we-use-rdng-extensions-api-to-detemine-the-artifact-type-of-the-currently-selected-artifact) but have the same undefined error.

Furthermore, when I debug it and watch the attrs.values, the artifact type is not listed.

Accepted answer


permanent link
Peter Morgenthaler (82513) | answered Jan 13 '15, 1:11 a.m.
edited Jan 13 '15, 1:15 a.m.
Hi Andrew,

You probably have not collected the ARTIFACT_TYPE when you collect the attributes using the getAttributes call.

Change the line where you get the attributes to include the optional parameter to load the both NAME and TYPE as per below.

RM.Data.getAttributes(selected, [RM.Data.Attributes.NAME, RM.Data.Attributes.ARTIFACT_TYPE], function(result) {

Then you should be able to get the value using the attrs.values[RM.Data.Attributes.ARTIFECT_TYPE]

Hope that helps
Andrew Lloyd selected this answer as the correct answer

Your answer


Register or to post your answer.