cancel
Showing results for 
Search instead for 
Did you mean: 

Instance variables not updating in ScriptTask

leggebroten
Champ in-the-making
Champ in-the-making
(Sorry if this ends up being a double post … the original one never appeared)

The simplified attached model has a very simple ScriptTask that tries to update a process variable.

The variable value is never updated.

Methods tried:
1) execution.setVariable. The attached model uses the execution.setVariable suggested in the documentation.
2) activiti:autoStoreVariables="true". I have also tried setting activiti:autoStoreVariables="true" but that doesn't work either. It looks like the engine is overwriting the value upon deploy. If you import the attached model, deploy it, then look at the XML from the deployment screen it shows activiti:autoStoreVariables="false"
5 REPLIES 5

trademak
Star Contributor
Star Contributor
Can you please create a unit test showing this issue and create a JIRA for it?
That would make it easier for us to reproduce it and fix it when applicable.
The deployment won't change the XML contents, are you sure this is a valid issue?

Best regards,

leggebroten
Champ in-the-making
Champ in-the-making
I will create a unit test for #1.
#2 is easy for to reproduce:
1) Through the ActivitiExplorer; import the provided model.
2) Through the ActivitiExplorer; deploy the provided model.
3) At the deployments screen in the ActivitiExplorer, each model has three links.  One for the process definition and 2 resources.  For the just-deployed model, export the .XML from the resources.
4) Diff the imported model and the exported model.  You'll notice that activiti:autoStoreVariables is now "false"

trademak
Star Contributor
Star Contributor
What do you mean with import the provided model?
Why don't you directly deploy the process definition to the Activiti Engine via the Management section?
When you first import the model into the model workspace the model is parsed for editing for the Activiti Modeler. The autoStoreVariables attribute is not part of this conversion yet so that's why you see this behaviour.

Best regards,

leggebroten
Champ in-the-making
Champ in-the-making
>> What do you mean with import the provided model?
From the ActivitiExplorer … Processes/Model Workspace/Import

>> Why don't you directly deploy the process definition to the Activiti Engine via the Management section?
* Because I didn't know it was there.  🙂
  I normally deploy immediately after editing in the Designer and the the "deploy" option is right there on "Model Workspace" so it didn't occur to me to look for another place to import or deploy a model.

>> The autoStoreVariables attribute is not part of this conversion yet so that's why you see this behaviour
Is this something you're recommending I always do, or is the problem strictly with the original model import?
Specifically, if I use activiti:autoStoreVariables="true", it sounds like I will need to adopt the following pattern when using the Designer:
1) Export model.
2) Edit file to restore attribute to "true"
3) Rename model file to remove the version numbers appended by OS (upload is restricted to .bar, .zip, .bpmn and .bpmn20.xml)
4) Switch to Manage
5) Deploy from Deployments/Upload New

Thanks for your support,

-Lee

leggebroten
Champ in-the-making
Champ in-the-making
Jira ticket with test …
http://jira.codehaus.org/browse/ACT-1948

Thanks again guys.