<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Non-mandatory properties not instantiated in content objects in a custom model in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/non-mandatory-properties-not-instantiated-in-content-objects-in/m-p/305983#M259113</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I discovered an Alfresco feature related to custom data modeling. I'm not sure if this is an intended feature. I am using Alfresco Community 4.2.e and Alfresco Enterprise 4.2.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Create a custom data model "my:model" including a new data type "my:datatype" that extends "cm:content" by adding a new property of type text "my&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;roperty". Package the new model in an AMP.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Create code that extends the Alfresco Share user interface to allow users to create and edit content objects of type "my:datatype". Package the interface extensions in an AMP.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Apply the AMPs to alfresco.war and share.war and restart Alfresco.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Create a new content object of type "my:datatype" using the Share user interface. Do not assign a value to the property "my&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;roperty".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Examine the new content object using the node browser. The property "my&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;roperty" appears and has no value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Create a web script that creates a new content object of type "my:datatype" as follows&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var node = userhome.createNode("My sample document", "my:document");&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;7. Execute the web script and examine the new content object using the node browser. The property "my&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;roperty" &amp;lt;strong&amp;gt;does not appear&amp;lt;/strong&amp;gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you write scripts that reference an object of type "my:document" and property "my&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;roperty", the script will blow up with a 500 error because the expected property is not present. In my case, a web script fails with error 500 and "freemarker.core.InvalidReferenceException" because the expected property is not part of the object being investigated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One way to prevent this from happening is to make the property mandatory in the data model. This is undesirable in many cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The solution I found to make sure the property is created with the object is to specify a blank default value in the data model and not make the property mandatory:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;property name="my:property"&amp;gt;&lt;BR /&gt; &amp;lt;type&amp;gt;d:text&amp;lt;/type&amp;gt;&lt;BR /&gt; &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;&lt;BR /&gt;&amp;lt;/property&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When defined like this, scripts referencing this property will always find it and not throw an exception.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this "missing property" feature expected in Alfresco? If so, is this something that might be referenced in the documentation?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lw&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Nov 2013 17:27:30 GMT</pubDate>
    <dc:creator>lw7415</dc:creator>
    <dc:date>2013-11-14T17:27:30Z</dc:date>
    <item>
      <title>Non-mandatory properties not instantiated in content objects in a custom model</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/non-mandatory-properties-not-instantiated-in-content-objects-in/m-p/305983#M259113</link>
      <description>Hello all,I discovered an Alfresco feature related to custom data modeling. I'm not sure if this is an intended feature. I am using Alfresco Community 4.2.e and Alfresco Enterprise 4.2.0.1. Create a custom data model "my:model" including a new data type "my:datatype" that extends "cm:content" by add</description>
      <pubDate>Thu, 14 Nov 2013 17:27:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/non-mandatory-properties-not-instantiated-in-content-objects-in/m-p/305983#M259113</guid>
      <dc:creator>lw7415</dc:creator>
      <dc:date>2013-11-14T17:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Non-mandatory properties not instantiated in content objects in a custom model</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/non-mandatory-properties-not-instantiated-in-content-objects-in/m-p/305984#M259114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Non-mandatory property would be initialized on content objects only when that property is set on content object explicitly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try to set blank value on property while creating/editing node.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2013 06:21:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/non-mandatory-properties-not-instantiated-in-content-objects-in/m-p/305984#M259114</guid>
      <dc:creator>yogeshpj</dc:creator>
      <dc:date>2013-11-25T06:21:56Z</dc:date>
    </item>
  </channel>
</rss>

