Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9061649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:32:21+00:00 2026-06-16T15:32:21+00:00

Is there a way to get the ScriptNode that initiated a state in an

  • 0

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?

Editing for clarity:
Here’s a screenshot of Eclispe with the Activiti plugin.
https://i.stack.imgur.com/RXTbl.jpg

This workflow gets started by another workflow with webscripts.

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());
}

So the listener calls another javascript method…

function artPDFRename()
{
    logger.log("==============================");
    logger.log("<START> artPDFRename");

    var workflowDef = workflow.getDefinitionByName(EL_WORKFLOW);
    var activeInstance = workflowDef.getActiveInstances();
        // ????
}

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.

Or am I so far off base on how we’re developing this that it makes no sense?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:32:22+00:00Added an answer on June 16, 2026 at 3:32 pm

    As an example check the ScriptTaskListener class. Here all the workflow variables are put in a map.

    The following code is interesting:

    // Add all workflow variables to model
    Map variables = delegateTask.getExecution().getVariables();

        for (Entry<String, Object> varEntry : variables.entrySet())
        {
            scriptModel.put(varEntry.getKey(), varEntry.getValue());
        }
    

    So with this you could use bpm_package as an object within your script within the workflow script task.

    So if you need the node were the workflow has run on, the following code should work (where task is your delegateTask from your notify method of the Listener:

    delegateTask.getVariable(“bpm_package”);
    // or like the example above
    delegateTask.getExecution().getVariable(“bpm_package”);

    This will be a list so take the first one and that will be your node.

    ———update

    If you’re using the javascript from alfresco then you can directly use the parent object bpm_package.

    So in your case it would be best to do the following:

    var node = bpm_package.children[0]; //or you could check if the
    package isn’t null
    // Then send the node into your
    artPDFRename(node); //or you could just add the bpm_package code in
    your js file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there easy way to get the hash tag in script source? Example: <script
Is there any way to get the ID of the element that fires an
Is there way to get file from windows xp command prompt? I tried to
is there way how to get name ov event from Lambda expression like with
Is there a way to get the item pointed at by an iterator in
Is there a way to get distance between two objects in meters? I'm trying
Is there a way to get the path to where WordPress is installed? I
Is there any way to get the previous hash using the history object ?I
Is there a way to get the actual columns name with ActiveRecord? When I
Is there a way to get HTML contents from TinyMCE editor using jQuery so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.