AnsweredAssumed Answered

Accessing Aspects with JavaScript

Question asked by slothrop on Aug 7, 2007
Latest reply on Aug 13, 2007 by slothrop
I have a custom aspect defined as follows:
   <aspects>
      <aspect name="custom:Reviewers">
         <title>Reviewers</title>
         <properties>
            <property name="custom:Reviewer1">
               <title>Reviewer1</title>
               <type>d:text</type>
            </property>
       <property name="custom:Reviewer2">
               <title>Reviewer2</title>
               <type>d:text</type>
            </property>
       <property name="custom:Reviewer3">
               <title>Reviewer3</title>
               <type>d:text</type>
            </property>
         </properties>
      </aspect>
   </aspects>

The aspect appears as it should and I can add reviewers to documents with no problem.  I would like to write a script that accesses these reviewers and sends emails to them when the document is moved to a certain space. 

document.hasAspect("custom:Reviewers") returns true as it should but document.aspects.length is undefined as is document.aspects.properties. 

document.aspects.size() returns 6 but I can't step through the aspects with document.aspects.properties since document.aspects.properties is undefined.  I can get an iterator with

   var docAspects = document.aspects;
   var it = docAspects.iterator();

but it.next() doesn't seem to return anything I can use.  One of the objects returned with it.next() does have a toString() that returns "{custom.model}Reviewers" but it.next().properties is undefined.

What am I missing?

Thanks in advance.

Outcomes