Modify subprocess variable from parent process

1
+1
-1

Hello everybody,

I use Bonita 6.4, and I created a WF which call multiple subprocesses.
The first step of the parent process is asking user some informations (title, comment, date, etc), then this parent process fire some children processes by passing them all datas the user entered.

But I would like to know if it's possible to create a human task on the parent process, this task changes the variables on the parent process AND on all the children processes ?
For exemple using a groovy script from the parent process, is it possible to access variables on all children processes and alter them?

Thanks for your help and sorry for my bad english...

1 answer

1
0
-1
This one is the BEST answer!

If you are going forward in the process then this will happen automatically with the mapping of the data, it will take the current value of the variable.

If going backward though...I give caution

So you have Parent1 with InitForm1, ServiceTask1, HumanTask2, ServiceTask3

Lets have a variable Date1

ServiceTask1 calls SubServiceTask1
HumanTask2 calls SubHumanTask2
ServiceTask3 calls SubServiceTask3

When we execute Parent1 we complete InitForm1 by picking Date1 (date easy to pick)

This is then used by ServiceTask1 and SubServiceTask1, which then returns to

Parent1 and moves onto HumanTask2.

In HumanTask2 we change the date...which executes SubHumanTask2 and you want to ALSO update the data in SubServiceTask1 with the new date.

OK yes it is possible, but I give caution that this could be construed as an illegal activity. When I use the word illegal I mean wrong, not in the legal sense of the word, though t could be applied if necessary.

The problem is chain of evidence for Auditors, who may have to audit your data, and the processes. You will fail.

I'm trying to think of any logical reason you would want to do this. If the data is wrong in SubServiceTask1, then you correct the reason it was wrong, not the result of why it was wrong.

What happens in the HumanTask2 if it relies on the data returned from SubServiceTask1? How would you handle that?

Seriously I would not do this and fix whatever is wrong in the process rather than try to fix the result...

However, to answer the question, yes it is possible, but I would not advise it.

regards
Seán

PS: If this reply answers your question, please mark a resolved.

Comments

Submitted by sylvain.jeandroz on Tue, 02/09/2016 - 13:28

Hello Sean McP,

Thanks for your response!

My use case is the following:

On the parent process, a user fill a form with small informations like title, description, document and a deadline date. After that, multiple subprocesses are fired with these informations. The deadline date is used to inform the user the deadline for executing the subprocess, and inside the subprocess there are timer mapped to this deadline to send email when the deadline is over.

But I want to let my user (the first one, who start the parent process) the possibility to change this deadline, so all the children process must to know this deadline has changed. That's why I wanted to do that

Submitted by Sean McP on Tue, 02/09/2016 - 14:24

Right,

I did a quick Google Search and found something that should help. And it will work better than "changing the timer" by "changing the timer". :)

What you really need in this case is:

Parent process: User fill a form with small information like title, description, document and a deadline date.

Parent Service Task: Save the processInstanceID and deadlineDate in a BDO (processInstanceDeadLineDate). The BDM is a simple two field one, processInstanceID and deadlineDate.

Then change ALL subprocesses to interrogate processInstanceDeadLineDate BDO for the latest date (use a non-Interrupting Timer and service task). Calculate if past setting a process variable (yeah! we need them), if the datepassed == true send the email, otherwise datepassed == false and wait for the next timer. You can interrogate processInstanceDeadLineDate hourly, daily etc. as required.

To update the processInstanceDeadLineDate BDO you just create a new Parent Process called "Change processName Deadline Date"

Doing it this way - fit's all the rules and allows Auditing of changes to Deadline Dates. This is a process design problem not a problem with Bonitasoft.

regards
Seán

For reference :

https://developer.ibm.com/answers/questions/194364/how-do-i-change-time-schedule-in-timer-uca.html

PS: If this reply answers your question, please mark a resolved.

Submitted by sylvain.jeandroz on Tue, 02/09/2016 - 14:43

Thank you again!
I have a small but important question... What is a BDO?
Sorry for this question which is maybe stupid but I never see this word in Bonita documentation?

Thanks in advance ;)

Submitted by vivek.paranthaman on Tue, 02/09/2016 - 15:27

Hi,
Bdo, is the business data object(in Java perspective, it cam be compared with your POJO/Vo class.
You can create it in the Business variable option in your Bonitasoft Studio.

Regards,

Vivek

Submitted by sylvain.jeandroz on Tue, 02/09/2016 - 15:35

aaa ok I understand

Thank you two for your responses, it help me a lot!

Unfortunatly, this mecanism seems to not exist into the Community Edition (sorry I forget to indicate I use Community edition)

Regards,

Sylvain

Submitted by Sean McP on Tue, 02/09/2016 - 16:10

Yes it does!!

A Business Data Model is what you generate...and a Business Data Object is an instance of that model.

So for example from the Getting Started example

travelRequest is a Model

whereas

travelRequest newTravelRequest = new travelRequest();

Creates a business data object of type travelRequest called newTravelRequest. However you are right the documentation generally refers to the BDM rather than the object. I'm sure this will be fixed one day.

@Vivek - opps sorry just seen your reply - thanks for that

@sylvain - yes it does in community in 7... However you can just use a database record to do the same thing,

regards
Seán

PS - Thanks for the vote.

Notifications