cancel
Showing results for 
Search instead for 
Did you mean: 

Script to change Document Type in Properties

jasonschroeder
Champ in-the-making
Champ in-the-making
Have an app sending html email into share repository.  Alfresco is assigning Document property of Plain Text.

I would like to get a script that simply changes the property setting from plain text to html and can be run as a rule whenever a new plain text doc hits the repository.  The transform and copy rule does not work for well for this.

I am sure this is a simple script but not very good with js

played around with some snippets online but none have worked:  Any help would be greatly appreciated

// change the Mimietype of this document
document.properties.mimetype = "html";
// save the property modifications
document.save();

var file = userhome.createFile("testfile.html");
file.content = "some HTML here";
file.mimetype = "text/html";
1 REPLY 1

jasonschroeder
Champ in-the-making
Champ in-the-making
// change the Mimietype of this document
document.properties.content.mimetype = "text/html";
// save the property modifications
document.save();