Custom models not showing in Alfresco Share after adding them

cancel
Showing results for 
Search instead for 
Did you mean: 
LeCehlou
Member II

Custom models not showing in Alfresco Share after adding them

Jump to solution

I was following this tutorial (https://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#introduc...) that a lot of people recommended to me and for some reason, models and aspects aren't displayed in the rules section and the other ones it should be displayed.

I know Alfresco detects the file, because if I try to voluntarily mess the syntax, I get an error at the launch of Alfresco. Any idea how to try fix it? I tried to recreate a project with the same exact version as the tutorial, doesn't seem to change anything.

 

share-config-custom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<alfresco-config>
   <!-- Document Library config section -->
   <config evaluator="string-compare" condition="DocumentLibrary">
        <aspects>
            <!-- Aspects that a user can see -->
            <visible>
                <aspect name="sc:webable" />
                <aspect name="sc:productRelated" />
            </visible>
            <!-- Aspects that a user can add. Same as "visible" if left empty -->
            <addable />
            <!-- Aspects that a user can remove. Same as "visible" if left empty -->
            <removeable />
        </aspects>
      <types>
         <type name="cm:content">
            <subtype name="sc:docs" />
            <subtype name="sc:whitepaper" />
         </type>
         <type name="sc:doc">
            <subtype name="sc:whitepaper" />
         </type>
      </types>
   </config>
</alfresco-config>

scModel.xml : 

<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <!-- Optional meta-data about the model -->
    <description>Someco Model</description>
    <author>Jeff Potts</author>
    <version>1.0</version>

    <!-- Imports are required to allow references to definitions in other models -->
    <imports>
        <!-- Import Alfresco Dictionary Definitions -->
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
        <!-- Import Alfresco Content Domain Model Definitions -->
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
    </imports>

    <!-- Introduction of new namespaces defined by this model -->
    <namespaces>
        <namespace uri="http://www.someco.com/model/content/1.0" prefix="sc" />
    </namespaces>
    <constraints>
        <constraint name="sc:campaignList" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Application Syndication</value>
                    <value>Private Event Retailing</value>
                    <value>Social Shopping</value>
                </list>
            </parameter>
        </constraint>
    </constraints>

    <types>
        <!-- Enterprise-wide generic document type -->
        <type name="sc:doc">
            <title>Someco Document</title>
            <parent>cm:content</parent>
            <associations>
                <association name="sc:relatedDocuments">
                    <title>Related Documents</title>
                    <source>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </source>
                    <target>
                        <class>sc:doc</class>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </target>
                </association>
            </associations>
            <mandatory-aspects>
                <aspect>cm:generalclassifiable</aspect>
            </mandatory-aspects>
        </type>

        <type name="sc:whitepaper">
            <title>Someco Whitepaper</title>
            <parent>sc:doc</parent>
        </type>

        <type name="sc:marketingDoc">
            <title>Someco Marketing Document</title>
            <parent>sc:doc</parent>
            <properties>
                <property name="sc:campaign">
                    <type>d:text</type>
                    <multiple>true</multiple>
                    <constraints>
                        <constraint ref="sc:campaignList" />
                    </constraints>
                </property>
            </properties>
        </type>

    </types>

    <aspects>
        <aspect name="sc:webable">
            <title>Someco Webable</title>
            <properties>
                <property name="sc:published">
                    <type>d:date</type>
                </property>
                <property name="sc:isActive">
                    <type>d:boolean</type>
                    <default>false</default>
                </property>
            </properties>
        </aspect>

        <aspect name="sc:productRelated">
            <title>Someco Product Metadata</title>
            <properties>
                <property name="sc:product">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <multiple>true</multiple>
                </property>             
                <property name="sc:version">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <multiple>true</multiple>
                </property>
            </properties>
        </aspect>
    </aspects>
</model>
1 Solution

Accepted Solutions
openpj
Moderator
Moderator

Re: Custom models not showing in Alfresco Share after adding them

Jump to solution

Your configuration is not completed, you have to add also a specific config node-type elements in share-config-custom.xml for configuring edit and view forms for each content type you have defined inside the custom model.

Add something similar to the following for each content type, in this case sc:doc type:

 

<config evaluator="node-type" condition="sc:doc">
      <forms>
         <form>
            <field-visibility>
               <show id="cm:name" />
               <show id="cm:title" force="true" />
               <show id="sc:relatedDocuments" />               
            </field-visibility>
         </form>
<forms>
</config>

Search forms must be defined in the config model-type element.

For more information take a look at the documentation here:

https://docs.alfresco.com/content-services/6.2/develop/share-ext-points/share-config/#displaytypemet...

 

 

View solution in original post

2 Replies
openpj
Moderator
Moderator

Re: Custom models not showing in Alfresco Share after adding them

Jump to solution

Your configuration is not completed, you have to add also a specific config node-type elements in share-config-custom.xml for configuring edit and view forms for each content type you have defined inside the custom model.

Add something similar to the following for each content type, in this case sc:doc type:

 

<config evaluator="node-type" condition="sc:doc">
      <forms>
         <form>
            <field-visibility>
               <show id="cm:name" />
               <show id="cm:title" force="true" />
               <show id="sc:relatedDocuments" />               
            </field-visibility>
         </form>
<forms>
</config>

Search forms must be defined in the config model-type element.

For more information take a look at the documentation here:

https://docs.alfresco.com/content-services/6.2/develop/share-ext-points/share-config/#displaytypemet...

 

 

LeCehlou
Member II

Re: Custom models not showing in Alfresco Share after adding them

Jump to solution

Thanks a lot, I was stuck on this for days ! 

(by the way you missed a closing " / " in your forms XML tag, just writing it here for helping the ones with the same problem as me)