How to populate a form with business data

1
0
-1

Hello community,

can anyone explain to me where I went wrong in trying to show the business data of a case in a task related form?

In the form editor I declared the following variables:
context = ../API/bpm/case/{{caseId}}/context
crData = ../{{context.cr_ref.link}} // the name of the business object declared both in the BDM and the pool is "cr"

The values of the input fields in form are linked to the crData variable (for example: "crData.id").

When I run the process the input fields are empty (null?) although the overview tab of the form presented along with the empty form in the portal shows all the correct business data in the cr object (for example: "id" as "CR-7014").

Where went I wrong?

Thanks in advance for your support.

Hanno Nocken

Comments

Submitted by Dibyajit.Roy on Wed, 02/06/2019 - 19:41

Hello
My suggestion is dont create context on your own. Create a new empty form and some basic variables are auto created. You need a couple of variables like task id, context , case etc.
Assuming all of them are created properly ,then your code is correct.
Take a Text field from the widget pane and place it in your form.
Remove the default data and write the new data as {{crData}}

Make sure your bonita portal is running because task id is collected as url parameter. Alternately, you can check the task id from the portal and save the value in your form in the task id variable. But make sure portal is running as user session will be needed.
Now when you preview your form, it should show you all the API key value pairs.
See if the variable returns anything.

regards

Submitted by info_1391831 on Thu, 02/07/2019 - 08:18

Thanks a lot, Dibyajit.

Everything works fine since I added the missing variable taskId as type URL value = id

Kind regards

1 answer

1
0
-1

Just to provide some additionnal information to Dibyajit answer:

If you want to create a task form from scratch you should define the following variables:

  • taskId (type: URL parameter), value: id
  • context (type: External API), value: ../API/bpm/userTask/{{taskId}}/context

Note that such context is only available on a form associated with a task. This is why we are using task id in the REST API call to get the context. Task id is provided as part of the URL that load the task form (potentially in an iframe).

For a case instantiation form (the form use to start the process instance) you have other parameter in the URL that either provide the process definition id or the process definition name + version.

In order to diagnose issues related to REST API calls I recommend to use the web developpers tools from your web browser. In the network tab you should be able to see REST API call that are failing for example with error 404 and the URL that was called.

Notifications