Display business data in other processes

Hi,

I am trying to display data from the business data of one process in another through the REST API.

Sample Process:
Process A sends a Message to Process B with the persistenceId of the business data of A. Process B recieves the persistenceId of business data A and saves it as “businessDataApersistenceId” (type long) to the business data B of process B.
Now I tried to get the data of business data A within the REST API like this:

I created two External API-variables in the UI designer of a User Task:

var1: …/API/bdm/businessData/com.company.model.“BusinessDataModel”/{{persistenceId}}/“BusinessDataVariable”>>

persistenceId: /bonita/{{context.“BusinessDataB”_ref.link}}/businessDataApersistenceId

“BusinessDataModel” = data model of process A
“BusinessDataVariable” = String variable of process A data model

Then I created an InputField with the variable: var1 , but I don’t get any Data.

When I display the business data persistenceId of A saved in business data B I get the right result. But I don’t know how to create a variable in the UI designer getting the persistenceId of business data A stored in business data B and use this varible as an parameter in the http get.

Maybe this is not the best way to get busniess data displayed in related procresses but the only approach I have.

Any suggestions? Many thanks in advance!

1 Like

Hi,

I tried it and here is what worked for me:

  1. External API variable “persistenceIDObject” with value: /bonita/{{context."BusinessDataB"_ref.link}}
  2. Javascript expression variable “persistenceId” with value: return $data.persistenceIDObject.businessDataApersistenceId
  3. External API variable “businessObject” with value: ../API/bdm/businessData/com.company.model."BusinessDataModel"/{{persistenceId}}
  4. Now you can access the variables via {{businessObject.BusinessDataVariable}} (in a text field)

However, I wouldn’t pass a business object via a second business object just for temporarily storing the persistenceID, and accessing the actual business object in a form. You still don’t have a reference to the original business object (e. g. if you want to use data from this object in a connector).

Instead, I would define a business variable of Type “BusinessDataModel” in process B. Then you can use an operation to instantiate that business variable with the following script:

import com.company.model.BusinessDataModelDAO; 
return BusinessDataModelDAO.findByPersistenceId(persistenceId);

It seems that your solution is definitely better and easier. Alltough instatianting the business variable with a script did not work for me. So I tried it with a Query expression and it works fine. Thank you!

hi, I have the same problem, can you share or screnshot your work? I’ve tried as written in this post, but has not succeeded.
thank you