Handling Process Variables

1
0
-1

Hello,

For the version of Bonita. How should I handle process variables now? The examples that I see online only focus on business variables.

Should I mainly only use business variables now for my applications? My v6.5 process uses mainly process variables not business variables and I've attached them to the form directly. How would I perform this in the new version? Or should I?

Thank you

2 answers

1
+2
-1

For a full reading of Business vs Process data please see the following:

Business data Process data

But to answer your very specific question...

You are recommended to use business data instead of process data for any data that has meaning outside of one single process. Process data are typically items of data which affect the path of the process, or are used at several steps of the process, but which become redundant, once the process instance has completed

So for example a Purchase Order which can be used in several places in a business would be Business Data, whereas you might have a test = is PO value > 10,000, returns a TRUE/FALSE to a boolean variable (PORequireAuthorization). It is this Boolean variable that is a process variable as it is not required anywhere else but this specific instance of the process case.

Hope that helps, regards

Comments

Submitted by mtdonovan on Thu, 07/02/2015 - 18:02

These are both great responses.

So, just to clarify, I'm building a person related process. I should build this within the business variables (or outside and import as a jar) and any decisions made within the process should be captured in process variables.

Submitted by Sean McP on Thu, 07/02/2015 - 21:34

You have to put this in context.

My way of thinking is...and others can pitch in because I don't have the full answer...

Business Data (Variables) would be, in this case:

table 1: Personnel Table (in database)

columns are

firstName surname addressLine01 addressLine02 addressLine03 position grade yearOfStarting

table 2: Benefits Table (in database)

columns are

grade benefit

the business logic would be something like this

Form 1: select person Form 2: current benefits gateway Form 3: (OPTIONAL) benefits to be assigned Form 4: (OPTIONAL) no benefits to be assigned And here is the important bit...

Between form 2 and 3 there is a piece of code that computes lengthOfService (a process variable) and the gateway says if lengthOfService > 50 then go to form 3 otherwise show form 4.

The business data (variables) is essentially static here (can be updated though), but the lengthOfService (a process variable) is computed every time the process executes...

So for one individual the on day 49 years 11 months and 31 days he will be on grade A, but on 50 years and above he will be on grade B.

I hope this helps.

I will be writing a blog piece over the weekend about how to convert existing database tables into BDM without manually adding them by hand. This function does not exist within BonitaSoft today. The BDM could be quite large if considering all processes that could be developed.

regards

Submitted by mtdonovan on Tue, 07/07/2015 - 15:35

This is great. Thank you for the further detailed explanation. I'm trying to decide about comments. If the comments supports the gateway decision. Should I include this variable in the process variable or the business variable?

This would be an approval or disapproval decision then the user would enter the disapproval comments.

Submitted by Sean McP on Tue, 07/07/2015 - 16:03

Before I answer, what is your answer to this question? You don't actually say one way or the other and you don't give a reason why you have chosen the one you have chosen...

:)

Homework, my lad, it never goes away...

1
+1
-1

Hello,

To access process variables from the UI designer, you should use the REST API (http://documentation.bonitasoft.com/bpm-api-1#activityvariable), when you create a new data of type External API you have a guideline with the examplo as well.

Cheers

Comments

Submitted by mtdonovan on Thu, 07/02/2015 - 18:06

First does activityvariable == process variable? Also, How would I PUT the value from the form to the activity variable (process variable)? I just see the GET method.

Submitted by Sean McP on Thu, 07/02/2015 - 21:38

Part 1, Yes av = pv UNLESS it is a transient variable which is not accessible.

Part 2, still working on that... :) sorry...

Submitted by mtdonovan on Thu, 07/16/2015 - 23:03

I can't seem to get this to work. I'm using the current taskId to try to pull my variable but it showing up empty

../API/bpm/activityVariable/{{taskId}}/[variable_name]

Submitted by Quentin Choulet on Fri, 07/17/2015 - 09:22

Hi,

You have to use the activityId and not the taskId. So it would be something like : ../API/bpm/activityVariable/{{activityId}}/[variable_name]

You can retrieve the activityId from the task object (caseId property). You can get the task object from the task id by calling : ../API/bpm/humanTask/{{taskId}}

Now, how to put a value in a variable. First you need to define a contract in BonitaStudio. Basically, the contract defines what should be returned by the form. Then, in the UIDesigner you have to link the values from your form into the contract entries. This is done in the formOutput variable. Each property of the formOutput object will be mapped to the contract entry with the same name.

Cheers

Submitted by mtdonovan on Fri, 07/17/2015 - 15:33

I have this linked to the form. I thought I could just use URL parameter to get the value for caseId, but it's not working. How do I get the caseId into variable?

activityId {"displayDescription":"","executedBySubstitute":"0","processId":"8435075298124187275","parentCaseId":"13003","state":"ready","rootContainerId":"13003","type":"USER_TASK","assigned_id":"201","assigned_date":"2015-07-17 08:27:59.074","id":"260006","executedBy":"0","caseId":"13003","priority":"normal","actorId":"1409","description":"","name":"Review and Submit","reached_state_date":"2015-07-17 08:27:53.616","rootCaseId":"13003","displayName":"Review and Submit","dueDate":"2015-07-17 09:27:53.349","last_update_date":"2015-07-17 08:27:53.616"}
Submitted by mtdonovan on Fri, 07/17/2015 - 17:22

Ok,

I added GUI variable called "activity" and then created "caseID" GUI variable with javascript expression

var result = $data.activity.caseId
    return result;

I should just be able to call a GET Rest call to get my process variable. Correct? I called ../API/bpm/caseVariable?p=0&c=10&f=case_id={{caseID}} to get a list of variables. I see my process variables. Is there another way to return my variables without perform another javascript expression.

Notifications