Access to Java variable in embeded-form before calling delegate expression

I have a situation that I need to get a variable from Java code and show it in my embedded form immediately after loading.
I am trying to access to my variable using execution listener in start event,
the problem is that this variable is available only after I click submit, a button that triggers delegate call.
I want to show my variable on form load.
any ideas ?

Hey Fardin! Welcome to the Community :slight_smile:
So you are trying to display a variable which is passed into the process when it is started right?
If so, you can write yourself an execution listener for the end of the start event to parse the data or set it to the execution.
After having done so, you should be good to go to retrieve it from within an embedded form.

The form could look like this:

<div class="form-group">
        <label class="control-label col-md-4">Display Variable:</label>
        <div class="col-md-8">
        <input type="text"
               cam-variable-name="x"
               cam-variable-type="String"
               readonly
               class="form-control" />
        </div>

Let me know whether that solved your problem. :slight_smile:

1 Like

Thanks for answer -the solution you proposed is the normal behaviour that I do always.
Here basically I want be able to access to variable at the start of the process.
I have no problem in accessing to variables when they are coming from another Task, the problem here is that :
I have to access to varibels value in the start event(the value comes from Java not other task) which I have my embeded form there too.
here what happening is that my execution listener in start event is called when I press submmit buttopn on my form, which is wronge because I need to show the data coming from exection-listenere on the form before submit,
which means my execution listenere should be callled when form is loading not after.


image

the pronblem is that as you can see the varibels value is not available on form , the listener is called after pressing submit button that is not my goal, and I need it before on form load.

any ideas ?

Ah, I see. So you are referring to the Form which can be showed upon the start of the process. I thought you are going to have a user task afterwards displaying the information.
If so it might be worth using the “start” event listener in which you should set the variable to execution.

1 Like

Already tried but not working,
Can you share a link of an example ?

What can be another way to achieve this goal?

any answers @Hafflgav ?

Apparently I haven’t found the time to try it out myself.
Maybe @Niall has some idea? :thinking:

1 Like

Hi @Fardin,

No process variables available until the process instance gets created (process is started).

Similarly, start event’s execution listeners don’t get executed before start process API is called.

If your need is to communicate with external source then below post might be of help to you