cancel
Showing results for 
Search instead for 
Did you mean: 

SOLVED:version history access properties of a custom model

rubenlor
Champ in-the-making
Champ in-the-making
i created a new custom model with this properties

<property  name="demo:demomodel">
                  <title>Tipo de Documento</title>
                  <type>d:text</type>
                  <mandatory>true</mandatory>
               </property>
               

               <property  name="demo:demomodel">
                  <title>Fecha del documento</title>
                  <type>d:date</type>
               </property>
               

               <property  name="demo:demomodel">
                  <title>Contenido</title>
                  <type>d:text</type>
               </property>

I'm trying to get this metadata of this custom model in the version history

I have this code

<#list document.versionHistory as record>

${record.versionLabel}
${record.name}
${record.description}
${record.createdDate?datetime}
${record.creator}
${record.nodeRef}   

            </#list>

How I can access the properties of my custom model?

I have read in the guide that

In Addition the properties and aspect as Described Above APIs are available for TemplateNode Which return the frozen history and state of the properties for the node version aspectos record.

How?
1 REPLY 1

rubenlor
Champ in-the-making
Champ in-the-making
i solved this problem
custom model

<?xml version="1.0" encoding="UTF-8"?>

<model name="demo:demomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Demo Model</description>
   <author>Rubenlor/author>
   <version>1.3</version>

   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <namespaces>
      <namespace uri="http://www.alfresco.com/content/1.0" prefix="demo"/>
   </namespaces>
   <types>
   
      <type name="demo:demomodel">
         <title>demo model</title>
         <parent>cm:content</parent>
            <properties>

<property name="demo:tipodocumento">
<title>Tipo de Documento</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>


<property name="demo:fechadocumento">
<title>Fecha del documento</title>
<type>d:date</type>
</property>


<property name="demo:contenido">
<title>Contenido</title>
<type>d:text</type>
</property>
</properties>
            
         
            <mandatory-aspects>
               <aspect>cm:versionable</aspect>
            </mandatory-aspects>
   
      </type>

view template

<#list document.versionHistory as record>
<#if record.properties["demo:tipodocumento"]?exists>
${record.properties["demo:tipodocumento"]}
</#if>
<#if record.properties["demo:fechadocumento"]?exists>
${record.properties["demo:fechadocumento"]}
</#if>
<#if record.properties["demo:contenido"]?exists>
${record.properties["demo:contenido"]}
</#if>
</#list>