AnsweredAssumed Answered

processTemplate error

Question asked by outlandish on Mar 1, 2013
Latest reply on Mar 7, 2013 by outlandish
Hi, I am trying to create a document that uses a custom template to fill up its content.

In an attempt to test it, I have run into issues. I get
org.alfresco.repo.jscript.ScriptNode cannot be cast to org.mozilla.javascript.Wrapper
error when I try to call the processTemplate function.


var tmp = search.luceneSearch("PATH:\"/app:company_home\"");
var companyhome = tmp[0];
var userhome = companyhome.childByNamePath("User Homes/bob/");

var form = userhome.createFile("output.txt");
node = search.findNode("workspace://SpacesStore/5515d3e1-bb2a-42ed-833c-52802a367033")

var args = new Array();
args['totalHours'] = 13;

var template = "<h3>Timesheet Form</h3>" +
               "Total Hours Worked: ${args['totalHours']}";

var result = node.processTemplate(template, args);

form.content = result;;

Appreciate any help. Thank you.