How to share a business variable between process in bonita 7?

1
0
-1

Hello,

I define a business object Client and create a process P1 where a business variable "clientList" -- List<com.company.model.Client> is initialized with a list of clients...
I want to use the value of my clientList in another process P2. Could anyone explain how to do it?

Thank you in advance!!!

2 answers

1
0
-1

Issue is related to a known bug that should be fixed in next maintenance release (7.1.1).

Bug is that if you try to access context that include an initialized business variable you will get a NullPointerException.

The temporary workaround would be to initialized the business data.

To identify such issue, I recommend to check web browser console (network): you can view here the HTTP status 500 (server internal error) and get some indication the HTTP response about the issue. To get more details you can also check Engine log file (you can access it directly in the Studio "help" menu).

Edit: 7.1.2 is now out and fix the issue.

Comments

Submitted by irina.rychkova_1 on Fri, 10/02/2015 - 18:04

Thank you for the help.
Could you explain a bit more how i can use a workaround?
Should i initialise a business variable using an operation for a process task instead of using «default» value? In this case, how can i use the query result in this operation?
Thanks a lot.

Submitted by antoine.mottier on Fri, 10/02/2015 - 18:32

You should define a default value for the "thesisPlan" business object. A simple script that return a new com.company.model.Plan should be enough.

Submitted by irina.rychkova_1 on Sun, 10/04/2015 - 21:37

That works well, thank you!

Submitted by antoine.mottier on Thu, 10/08/2015 - 10:24

Your welcome.

Note that 7.1.2 is now out and fix this issue.

1
0
-1

On process P2, you should define a business variable of type List<com.company.model.Client> and define the default value with "Expression type" set to "Query". That will run a select query on the business database to retrieve existing data.

You can use queries created by default such as "find" that retrieve all business object (actually not all as it use pagination).

You can also use custom search query that you can create (using JPQL) in BDM definition. Such custom queries can have input parameters and custom filter logic (using WHERE statement).

Comments

Submitted by irina.rychkova_1 on Thu, 10/01/2015 - 22:19

Hi Antoine,
thank you for your answer. This was my idea too. However I cannot see if it works..
I explain:
In my P2 I define the business variable clientList_1 of the type List<com.company.model.Client> and use the find query to specify the default value for clientList_1 (exactly as you explained).

In order to test my case, I run P1 from Bonita studio first and initiate the clientList via Bonita portal. Than I run P2 from Bonita studio and try to display the content of my clientList_1 in a table:
To do so, I create a form where I define a vriable (External API) for this list:
cList --> /bonita/{{context.clientList_1_ref.link}}
I try to display any information on it using both a table widget and a simple text area where I try {{cList | json}} .
I get nothing...

I try to figure it out if my processes simply "do not see each other"? Cannot be the case?

Otherwise, how else can I test my clientList_1 (P2) if it was initialised with the values of clientList (P1) or not?

Thank you in advance!

Submitted by antoine.mottier on Fri, 10/02/2015 - 09:04

As far as I can tell you did exactly what need to be done.

Can you share your processes so I can take a look? Export them as a single bos file including the business data definition.

Thanks

Submitted by irina.rychkova_1 on Fri, 10/02/2015 - 10:57

Hi Antoine, thanks for your offer! Would be a great help for me.
Could you contact me by email ( irina.rychkova g m a i l ) so I can send you the project by email?

Thanks a lot.
Irina

Submitted by antoine.mottier on Fri, 10/02/2015 - 11:02

Can you share the file with for example drop box? That way it might help someone else to get started with similar use case.

Notifications