AnsweredAssumed Answered

ScriptTaskListener not working?

Question asked by hoangclinh on Jun 2, 2016
Latest reply on Jul 18, 2018 by afaust
Hi everyone,

I faced 2 case with the ScriptTaskListener problems:

- Case 1: I change the Adhoc Workflow Definition:

<blockquote>

<class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
                  for(var i = 0; i < bpm_package.children.length; i++) {
                  if(!bpm_package.children.getSiteShortName()){
                    bpm_package.children.setPermission("Contributor", "${bpm_assignee.properties.userName}");
                    }   
                  else {
                     bpm_package.children.setPermission("Contributor", "${bpm_assignee.properties.userName}");
                      }

                  }]]></activiti:string>
          </activiti:field>
          <activiti:field name="runAs">
            <activiti:string>admin</activiti:string>
          </activiti:field>
        </activiti:taskListener>

</blockquote>

But, sometimes it's working, sometimes it's not. WHY?

- Case 2: I've created a new Workflow definitions based on Adhoc template, and try to put logger.log to debug, but, nothing write to log even i put:
+ Share log4j
<blockquote>
# Web Framework
log4j.logger.org.springframework.extensions.webscripts=info
#log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=debug
log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off //Alfresco start error if i turn on this option
</blockquote>
+ Share log4j
<blockquote>
log4j.logger.org.alfresco.repo.jscript=DEBUG
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
</blockquote>
WHY?

Outcomes