问题
I am trying to run a script task in alfresco process services, while compiling the script there were some error throw out in the console as like:
the console couldn't run 'javascript'
var x=5;
var y=5;
var xy=x*y;
document.write("The result is"+xy);
I expect the result as 25
that could be print in the console after the compilation of the script. Can anyone help me to resolve the issue?
回答1:
Where/how are you running that code? Do you have a concrete error?
Most probably the "document" gets recognized as a root object, so the "write" method fails. If my theory is true, simply commenting that line out or replacing it with "logger" (another root object) will solve the issue.
https://docs.alfresco.com/4.1/references/API-JS-rootscoped.html
EDIT: Now I realize you specified a Script Task. I believe my theory is still relevant, however, root objects available are not the same.
https://docs.alfresco.com/5.1/references/API-JS-WorkflowService.html
来源:https://stackoverflow.com/questions/54343080/how-to-configure-the-alfresco-to-run-a-script-task