cancel
Showing results for 
Search instead for 
Did you mean: 

I've created custom content types ...... Now what?

ustamills
Champ in-the-making
Champ in-the-making
I'm BRAND NEW to Alfresco and I'm trying to boot up the Alfresco Community version to see if my company can use it for what it needs.

I followed Jeff Potts doc on creating custom content types and successfully have new data types for invoices, checks, bank statements, and contracts.  I know this because I can see those data types in Rules for folders.

Now, I need to create these new doc types, but I guess I'm not sure where next to go.  I'd like to have a mechanism where someone in accounting can add a file into Alfresco and Alfresco  will ask for the doc properties (like invoice number, payee, etc).

So, what's next?  Can I do that with out-of-the-box Share?  That would be awesome!  But I couldn't figure out how to make that happen.  Do I need to customize Share?

Thanks for any pointers you can provide.

Drew
3 REPLIES 3

rjohnson
Star Contributor
Star Contributor
If you add a single page PDF for each doument type to the Node Templates folder in the repository, go to document detail display and change the document type to Invoice, check, bank statement etc you users can use "Create content by templated node" in the document library of a site and that will copy the blank document and throw them straight into the edit metadata form where they can do the input you want.

Alternatively, if you have scanned images you can simply upload those into the document library, go to the document details and change the document type to the apporpriate one and then select "Edit metadata" and input what you want that way.

Bob Johnson

ustamills
Champ in-the-making
Champ in-the-making
I kinda thought that might be the case. I tried uploading a file and then changing it's doc type but the only type I saw in the drop down was Article.

But I know my types are in there because I can use them making rules. I'm confused.

rjohnson
Star Contributor
Star Contributor
You need to "tell" Alfresco Share to make them visible. To do this you need to add them to a file called share-custom-config.xml (should be in {alfresco-root}/shared/classes/alfresco/web-extension).

This is a key file for reconfiguring and extending the OOTB functionality. You need to have a section in the file as shown below; once you do and you have restarted Alfresco, you should see your new document types. The placeholder comment is usually in the example share-config-custom.xml that is provided. As you are new to Alfresco, be aware that anything that is in share-confog-custom.xml overrides the standard configuration, so keep it minimal to start with.


      <!–
         Used by the "Change Type" action

         Define valid subtypes using the following example:
            <type name="cm:content">
               <subtype name="cm:mysubtype" />
            </type>

         Remember to also add the relevant i18n string(s):
            cm_mysubtype=My SubType
      –>
      <types>
         <type name="cm:content">
            <subtype name="{your first doc type}"/>
            <subtype name="{your next doc type}"/>
         </type>
         <type name="{your first doc type}">
            <subtype name="{your next doc type}"/>
         </type>
      </types>


You can structure types with parents, in the example above, you make 2 new document types the children of cm:content (where everything starts unless you deem otherwise) so you will be able to select either first doc type or second doc type off the list. In the second <type></type> you make "next doc type" the child of "first doc type" so if you create a document and make it "first doc type" you can subsequently only change it to "next doc type".

You probably do need a complex structure like this, so you could probably just have something like:-


      <!–
         Used by the "Change Type" action

         Define valid subtypes using the following example:
            <type name="cm:content">
               <subtype name="cm:mysubtype" />
            </type>

         Remember to also add the relevant i18n string(s):
            cm_mysubtype=My SubType
      –>
      <types>
         <type name="cm:content">
            <subtype name="{your invoice doc type}"/>
            <subtype name="{your checks doc type}"/>
            <subtype name="{your bank statements doc type}"/>
            <subtype name="{your contracts doc type}"/>
         </type>
      </types>


Be aware you cannot go "back up the tree" so once you have changed a document type to a subtype, you cannot change it back to the parent type. That sounds picky, but it isn't because your new document types essentially extend cm:content and so have metadata that cm:content won't have. Once you have made something a subtype it has that metadata if you go back, it shouldn't have that metadata but it does and in that case Alfresco would not know quite what to do with it.

This is in keeping with Alfresco data models generally, you can extend them, but you should not remove from them (although you can pretend that something isn't there) or change a model property once there is content of that type (even if the content is in the trashcan). If you do, you will get some really nasty errors that are the devil to get rid of.

Good luck

Bob