So this thread has lots of good pointers and good ideas but none really answered properly and I have been struggling getting it work.
To answer the question:
is it possible to access process parameters from instantiation form
The answer is:
Yes ! Read on
I ran some testing and here is the conclusion and some explanation about the confusion.
When you let Bonita generate a form, it tries to be helpful and it is in most cases but NOT for the init form.
You should NOT try to search your process by name, that will only lead to issues later on.
The ONLY thing you have is a form parameter called id. The generated form declares it and use it to fetch the task and taskId and processId from that. THIS IS WRONG.
What you want is a new variable:
- name: processId
- value: id
- type: URL parameter
To debug, in your form, you may add a text field with the content:
When you start your process, the init form should show up and it should show something similar to:
processId: 8277182323322251349
If you do not get that, no need to move on, try finding what you did wrong. You may use a blank new test form to troubleshoot.
Now say you have a foobar process parameter you need to access. You will create a new variable for that (you can also use 2 but if you get it to work with one, you will likely manage the rest):
- name: foobar
- type: External API
- value: ../API/bpm/processParameter/{{processId}}/foobar
You may add a text field to debug with the content foobar json: {{foobar | json}}
WARNING: Beware that the foobar variable does NOT contain (directly) the VALUE of your parameter, it is a JSON object that contains the value you want under the value property.
Let's add another debugging field: foobar {{foobar.value}}
And here you go, you now accessed a process parameter only with the provided id (which is the PROCESS ID and not the TASK ID in the specific case of an init form), without using smelly name based query and retrieved a random process parameter.