Reputation: 141
Alfresco process.bpmn20.xml file how can i access java delegate variable is possible please help me out
Here
var procInstVariable = execution.getVariable('trainername') //java delegate variable
java delegte code variable but i am getting error
Error:
Not defind node
Example code:
<serviceTask id="serviceTask3" name="Attach Training Curriculum Template Document" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
<extensionElements>
<activiti:field name="script">
<activiti:expression><![CDATA[
var procInstVariable = execution.getVariable('trainername') //java delegate variable
var dest= companyhome.childByNamePath("Sites/test/documentLibrary/"+procInstVariable);
bpm_package.addNode(dest);
]]></activiti:expression>
</activiti:field>
</extensionElements>
</serviceTask>
Upvotes: 0
Views: 428
Reputation: 1486
Creating variable in BPMN file and accessing them into Java Delegate
For ex in bpmn file,
execution.setVariable('trainername','SOME_TRAINER');
Now you can access the trainername in the java delegate otherwise, you may get NPE.
In Java code
var procInstVariable = execution.getVariable('trainername')
or
String procInstVariable =(String) execution.getVariable('trainername')
Creating workflow variable in Java delegate and accessing them into workflow
In your java delegate code,
execution.setVariable('trainername','SOME_TRAINER');
You can access in BPMN file like,
var procInstVariable = execution.getVariable('trainername')
Please let me know, if I understood wrongly or any help on this.
Upvotes: 2