How to assign the value to that process variables at a one stretch in Bonita 7.x

1
0
-1

Hi All,
I am new to the Bonita working on Bonita 7.X and I loved to learn Bonita, looking solution for below query.

Query: I have a more the 5 process variable and I would like to set the value to that process variable at a one stretch.

Example:
Process variables: cusName, cusID, cusAdd, cusCity, cusZip, ect...

Here I could like to set the value to the above process variable at a one stretch not to set value to the variable one by one.

Tried Steps: REST, Contract and Business Data Model. Here everything, we have to set value to the process variable one by one.

Kindly help me to provide a way to achieve. Deeply looking for your valuable response.

Thanks,
Rajiv M

2 answers

1
0
-1

Yep, You're doing this all wrong.

You don't define process variables in the Connector. In your code above the Def CustID will only survive as long as the connector is working - once it's finished will will die.

You define process variables in the DATA tab of the process lane (or step).

And as you are hard coding these items you will be able to assign a default value at the same time.

  1. Open Studio
  2. Open Diagram
  3. Click on Pool
  4. In Details Area - Click Data Tab
  5. On right hand side Add Process Variables and give it a default value.

Done.

Similarly you could define all you variables as above and then in a connector initialize all variables as follows:

apiAccessor.getProcessAPI().updateProcessDataInstance("{variableName}", processInstanceId, true);

so in your example:

apiAccessor.getProcessAPI().updateProcessDataInstance("customerID", processInstanceId, 101);
apiAccessor.getProcessAPI().updateProcessDataInstance("customerAddress", processInstanceId, "Test");
apiAccessor.getProcessAPI().updateProcessDataInstance("customerName", processInstanceId, "Test");
apiAccessor.getProcessAPI().updateProcessDataInstance("customerZipcode", processInstanceId, 10020);

Or you could use the (since 6.2.3) call updateProcessDataInstances to update all variables in one call using a Map Key-Value pairing. See Javadoc here http://documentation.bonitasoft.com/javadoc/api/7.4/index.html and search for updateProcessDataInstances

regards
Seán

PS: As this reply answers your question, please mark as resolved.

Comments

Submitted by sachin.rajiv8 on Mon, 01/09/2017 - 11:47

Hi Sean McP,

Thank you so much :) working fine as you suggested :)

Regards,
Rajiv M

Submitted by sachin.rajiv8 on Mon, 01/09/2017 - 11:47

Hi Sean McP,

Thank you so much :) working fine as you suggested :)

Regards,
Rajiv M

1
0
-1

What do you want to do?

It reads like you want to do

cusName, cusID, cusAdd, cusCity, cusZip = "";

This is not possible in Java. You need to:

cusName = "";
cusID = "";
cusAdd = "";
cusCity = "";
cusZip = "";

regards
Seán

PS: As this reply answers your question, please mark as resolved.

Comments

Submitted by sachin.rajiv8 on Fri, 01/06/2017 - 07:40

![Capture custID edit mode](E:\Capture custID edit mode "Capture custID edit mode")

Thanks Sean Mcp, for your valuable comments.

please refer the attached image(Capture). instead of assigning the value one by one, i need to assign the value at a stretch to avoid the repeated code for all the variable.. kindly refer the image (Capture custID edit mode)

Submitted by sachin.rajiv8 on Fri, 01/06/2017 - 08:06

Example
customerID Take a value of custID Go to edit mode assign the value using Groovy Script
"def customerID=null;
customerID=101;
return customerID;"

customerName Take a value of custName
"def customerName=null;
customerName=""Test"";
return customerName;"

customerAddress Take a value of custAdd
def customerAddress=null;
customerAddress=""Test"";
return customerAddress;"

customerZIP Take a value of custZIP
def customerZIP=null;
customerZIP=2876
return customerZIP;"

To avoid the repeated code for all the variable, I need to set in one time for all the variable , like below how to I achieve it. Please help.

def customerID=null;
def customerAddress=null;
def customerName=null;
def customerZipcode=null;
customerID=101;
customerAddress="Test";
customerName="Test";
customerZipcode=10020;

Looking for your response.

Thanks
Rajiv M

Notifications