AnsweredAssumed Answered

Importing javascript into a workflow

Question asked by buje85 on Sep 19, 2014
Latest reply on Sep 22, 2014 by buje85
Hi,

I am trying to launch a workflow when one ends so i have written the code to launch the next workflow in a js file. I cant get the task listener to run the function in my script file.

I have looked around for ages but cant see any examples to check if I have done something stupid. I have run the import line and then called the function in the javascript console add it and everything runs fine so it is just a syntax error. This is using activiti.


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="testScriptWorkflow" name="test scripting process" isExecutable="true">
    <startEvent id="alfrescoStartevent1" name="Alfresco start" activiti:formKey="wf:submitAdhocTask"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:formKey="wf:adhocTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[<import resource="/Company Home/Data Dictionary/Scripts/testingwfl.js">;testLaunch();]]></activiti:string>
          </activiti:field>
          <activiti:field name="runAs">
            <activiti:string><![CDATA[admin]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow3" sourceRef="alfrescoStartevent1" targetRef="alfrescoUsertask1"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="alfrescoUsertask1" targetRef="endevent1"></sequenceFlow>
  </process>


can anyone help? Am I using the incorrect class?

Outcomes