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

**URL:** <https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501>\
**Category:** Q&A\
**Created:** [28 September 2015 20:30 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501 "2015-09-28T20:30:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![irina.rychkova\_1](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@irina.rychkova\_1](https://community.ofelia.com/u/irina.rychkova_1)\
**Post date:** [28 September 2015 20:30 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/1 "2015-09-28T20:30:09Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [29 September 2015 09:25 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/2 "2015-09-29T09:25:18Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [2 October 2015 15:04 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/3 "2015-10-02T15:04:07Z")

</div>

Issue is related to a [known bug](https://bonita.atlassian.net/browse/BBPMC-308?focusedCommentId=18504&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-18504) 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.

---

<div class="post-metadata">

**Author:** ![irina.rychkova\_1](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@irina.rychkova\_1](https://community.ofelia.com/u/irina.rychkova_1)\
**Post date:** [1 October 2015 20:19 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/4 "2015-10-01T20:19:56Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [2 October 2015 07:04 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/5 "2015-10-02T07:04:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![irina.rychkova\_1](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@irina.rychkova\_1](https://community.ofelia.com/u/irina.rychkova_1)\
**Post date:** [2 October 2015 08:57 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/6 "2015-10-02T08:57:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [2 October 2015 09:02 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/7 "2015-10-02T09:02:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![irina.rychkova\_1](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@irina.rychkova\_1](https://community.ofelia.com/u/irina.rychkova_1)\
**Post date:** [2 October 2015 16:04 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/8 "2015-10-02T16:04:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [2 October 2015 16:32 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/9 "2015-10-02T16:32:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![irina.rychkova\_1](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@irina.rychkova\_1](https://community.ofelia.com/u/irina.rychkova_1)\
**Post date:** [4 October 2015 19:37 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/10 "2015-10-04T19:37:30Z")

</div>

That works well, thank you!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [8 October 2015 08:24 UTC](https://community.ofelia.com/t/how-to-share-a-business-variable-between-process-in-bonita-7/6501/11 "2015-10-08T08:24:01Z")

</div>

Your welcome.

Note that 7.1.2 is now out and fix this issue.
