cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variables from one

fahadnajib
Champ in-the-making
Champ in-the-making
Hi All,
I am trying to pass variables from one class that implements Javadelegate to another class that also impelements javadelegate. But its value is always null.


I am simply doing this in my first class namely WorkPackage:

public class WorkPackage implements JavaDelegate {
    public void execute(DelegateExecution delegateExecution) throws Exception {
          delegateExecution.setVariable("WorkPackage1","WorkPackage1");
}


And trying to read this variable in other class namely class ZDTasks


public class ZDTasks implements JavaDelegate {
    public void execute(DelegateExecution delegateExecution) throws Exception {
       String workPackage1 = (String) delegateExecution.getVariable("workPackage1");
        System.out.println("Workpackage1 value "+workPackage1);
}

my workflow is like:
start event -> Service Task(with class WorkPackage, here i set the variable) -> parallel gateway (this goes into following two)

1. Service Task (with class ZDTasks) <–here I am trying to read the variable.
2. Service Task (with class MailTask) <–not relevent in my question so not provided the source code

(I have attached the process file)


would appreciate any thoughts on what I might be doing wrong.
1 ACCEPTED ANSWER

warper
Star Contributor
Star Contributor
Hi!
I think you should use getVariable("WorkPackage1"…
instead of getVariable("workPackage1"…

View answer in original post

2 REPLIES 2

warper
Star Contributor
Star Contributor
Hi!
I think you should use getVariable("WorkPackage1"…
instead of getVariable("workPackage1"…

fahadnajib
Champ in-the-making
Champ in-the-making
Hey Warper, yep noticed it after posting my comment and it worked, thankyou for your reply.