is it possible to access process parameters from instantiation form

1
0
-1

Hi,

I'm trying to initialize some lists in my instantiation form using process parameters.

I've tried to use the Rest API :

../API/bpm/processParameter/{{processId}}/myProcessParameter1

To retrieve the process ID, I tried to use :

../API/bpm/process?f=name={{nomProcessus}}?f=version={{versionProcessus}}

with

nomProcessus as a string = liaison TE ATA 2 ou LLO fibre dédiée

and versionProcessus as a string = 1.7

but I get no data.

Am I doing something wrong or is it impossible?

4 answers

1
0
-1
This one is the BEST answer!

The process Id is actually available using the url parameter "id", it is the same I get from the correct API call (thanks Adrien!) : ../API/bpm/process?p=0&c=1&f=name={{processName}}&f=version={{processVersion}}

After some tests, it seems the problem I had was related to some other problems in my form. The current steps I tried in the beginning are working now, after I did many modifications:

  1. Create a variable named "processId" with the type URL parameter : id
  2. Create a variable named "myParameter" with the type External API : ../API/bpm/processParameter/{{processId}}/myParameter
  3. Get the value of the parameter by using {{myParameter.value}}

1
+1
-1

Hello,

The answer of Miguel is correct if you are only interested by the definition of the parameter, if you want to retrieve its value at runtime it won't be enough.

Your solution is the right one, but I think that you failed something when you tried to retrieve the process definition id.

In a form generated by the Bonita Studio, a variable `task` is created by default, it represents the instance of the task associated to this form.
This variable `task` is a Json object, it contains the process definition id.

So, to easily retrieve a process parameter named `myParameter` from a form:

  1. Create a new variable with the type External API named `myParameter`
  2. Insert the following API call : `../API/bpm/processParameter/{{task.processId}}/myParameter`
  3. get the value of your parameter by using {{myParameter.value}}

Adrien

Comments

Submitted by torea_1402565 on Wed, 04/01/2020 - 20:43

Thanks Adrien, but it seems the variable task is not created or created empty.

Is it because I'm in the instantiation form?

Submitted by torea_1402565 on Wed, 04/01/2020 - 20:52

For the other forms, i'm using the url parameter "id", which is the task id, to get the task details with the api.

But for the instantiation form, the id in the url does not seem to be a task id, or a process id.

Submitted by adrien.lachambre on Thu, 04/02/2020 - 12:49

Yes, sorry about that, I forgot that on the instantiation form you do not have this quick access.

You can't retrieve any task or case ID from this instantiation form, because the case hasn't been instantiated yet.

So you'll have to retrieve the process definition id by yourself.
The correct API call is:

../API/bpm/process?p=0&c=1&f=name={{processName}}&f=version={{processVersion}}

Keep in mind that you will have to update this call each time you will update the process version. If you plan to do it often, then I suggest you to remove the version filter in the API call, to retrieve like 50 results (c = 50) and then to retrieve the last version with some javascript.

Adrien

1
0
-1

Hi,

I think the approach is not valid. I explain it.

If what you want is to populate some lists on your forms, I would use BDM, kind of MasterData or ReferencialData.

ProcessParameters does not allow lists, so you will be limited to a comma separated string of N caracters (I think 255)

Cheers

1
0
-1

Hi,

You can retrieve process definition information (including process definition parameters) through the DesignProcessDefinition object. See below (extracted from the documentation on this topic):

Retrieve the design for a process

Process design can be retrived client side.

  • URL
    /API/bpm/process/:processId/design
  • Method
    GET
  • Success Response
    The process design object. The JSON returned is a representation of the DesignProcessDefinition instance of the given process id.
    • Code: 200

Hope it helps

best

Comments

Submitted by torea_1402565 on Wed, 04/01/2020 - 20:35

Thanks Miguel but the problem is that I cannot get the process Id.

Notifications