title: Alfresco Activiti script task listener current scriptnode?
body: <p>Is there a way to get the ScriptNode that initiated a state in an Activiti workflow in Alfresco? I have a ScriptTask in my workflow, and it has a Alfresco Script Listener set up for the Start event. When the script is called, I'd like the ScriptNode that transitioned into the ScriptTask in the workflow to be passed as a parameter to the function defined as the listener. Is that possible?</p>
  
  <p>Editing for clarity:
  Here's a screenshot of Eclispe with the Activiti plugin.
  <a href="http://i.imgur.com/DAKtq.jpg" rel="nofollow">http://i.imgur.com/DAKtq.jpg</a></p>
  
  <p>This workflow gets started by another workflow with webscripts.</p>
  
  <pre><code>var props = new Object();
  var dd = new Date();
  props[EL_PROP_WORK_UNIT_NAME] = "testNode" + DateISOString( dd );
  props[EL_PROP_WORK_UNIT_SOURCE_CODE] = "ROB";
  props[EL_PROP_WORK_UNIT_DELIVERY_DATE] = dd;
  
  node = getHome().createNode(name, EL_TYPE_WORK_UNIT, props);
  
  var EL_WORKFLOW = "activiti$The-workflow";
  var activeWfs = node.activeWorkflows;
  if( activeWfs === null || activeWfs.length === 0 )
  {
      var workflowPackage = workflow.createPackage();
      workflowPackage.addNode( node );
      var workflowDef = workflow.getDefinitionByName(EL_WORKFLOW);
      var workflowPath = workflowDef.startWorkflow( workflowPackage, new Object());
  }
  </code></pre>
  
  <p>So the listener calls another javascript method...</p>
  
  <pre><code>function artPDFRename()
  {
      logger.log("==============================");
      logger.log("&lt;START&gt; artPDFRename");
  
      var workflowDef = workflow.getDefinitionByName(EL_WORKFLOW);
      var activeInstance = workflowDef.getActiveInstances();
          // ????
  }
  </code></pre>
  
  <p>The goal is to have this handling be automatic. We're trying to design this with as little of manual intervention as possible, and are not assigning tasks to users to perform. Yes, there's probably another way to rename a PDF file, but I can't seem to figure out from the documentation listed here how to get a pointer to the node I put in the bpm_package object. That's the question.</p>
  
  <p>Or am I so far off base on how we're developing this that it makes no sense?</p>