AnsweredAssumed Answered

Script to change Document Type in Properties

Question asked by jasonschroeder on Apr 4, 2014
Latest reply on Apr 4, 2014 by jasonschroeder
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";

Outcomes