cancel
Showing results for 
Search instead for 
Did you mean: 

Change content type after upload

joshaber
Champ on-the-rise
Champ on-the-rise
Hey all, is there a way to change a node's content type after uploading? Either programatically or with a rule or…?

Thanks!
15 REPLIES 15

mabayona
Champ on-the-rise
Champ on-the-rise
Yes, as long as the new type is a subtipe, you can execute an action (e.g. asociated to a rule/simple workflow) or manually via web client to change to the new sub type.

This is available as "Run Action" in "details" icon. "Select an action" => And the action is "Specialise the type of an item".

Hope it helps.

joshaber
Champ on-the-rise
Champ on-the-rise
Ah, I should have seen that. Gracious!

arunkr85
Champ in-the-making
Champ in-the-making
But the Run cation wizard page shows empty combo box


Regards

arun

jarrett
Champ in-the-making
Champ in-the-making
Hello,

Make sure to add a section similar to this to web-client-config-custom.xml

            <!– The list of types shown in the is-subtype condition –>
            <subtypes>
               <type name="yg:research"/>
               <type name="yg:marketing"/>
               <type name="yg:survey"/>
               <type name="yg:data"/>
               <type name="yg:consulting"/>
               <type name="yg:doc"/>
            </subtypes>

Adding this will allow the drop down to populate with values.

–js

jarrett
Champ in-the-making
Champ in-the-making
Sorry I replied too quickly, its 'specialise type' that you need. It would look similar to:

         <config evaluator="string-compare" condition="Action Wizards">
            <specialise-types>
               <type name="yg:research"/>
               <type name="yg:marketing"/>
               <type name="yg:survey"/>
               <type name="yg:data"/>
               <type name="yg:consulting"/>
               <type name="yg:doc"/>
            </specialise-types>
         </config>


my recommendation is to fill out all the config settings for the Action Wizards, it will make like easier and good examples should be in the wiki.

–js

arunkr85
Champ in-the-making
Champ in-the-making
Thanks jarret

I will try it out

NB: Don't reply too quickly


—arun

systec
Champ in-the-making
Champ in-the-making
Hi

While one can specialise the type after upload using the action, is there a way to programmically do this? The javascript API provides a way, via the createNode function, to set the type at node creation but i cannot see anything that allows one to "specialise" the type after creation. Is there an API call that allows this?

In some other similar related topics people have suggested applying a rule against a space to set the type. That solution only fits when all the documents in a particular space are of the same type. I'd like to create a webscript that allows a user to "specialise" the type via Alfresco Share. I was able to use the Actions API to call the "specialise the type of an item" action using a custom script. Next i will try using this script in a webscript…unless of course there is a direct API call that will do the same.


var myAction = actions.create("specialise-type");
myAction.parameters["type-name"] = "{http://www.someco.com/model/content/1.0}doc";
myAction.execute(document)

systec
Champ in-the-making
Champ in-the-making
I found the ScriptNode API function call that i was looking for -

boolean specializeType(string type)

My apologies, it seems the functionality to allow Share to specialise the type is already available in 3.2. The action is available from within the document details page.

jzulu2000
Champ in-the-making
Champ in-the-making
If I understood the question, you have to change the content type of a node, not the type of a node…

For changing the content type, you can do the following in a script:

document.mimetype = "new/content-type";// i.e. document.mimetype = "application/pdf";