How to configure the alfresco to run a script-task

2019-08-31 10:49发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-31 11:05

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

查看更多
登录 后发表回答