According to your code example your are not only updating the business object attribute but you are actually creating a new instance of this business object by calling the new operator.
Can you clarify when and how the process variable is initialized and also when is the business variable initialize and when do you want to update it? (by when I mean in the default value of the variable, in an operation, in connector output…).
Note that sharing your process (exported as a .bos file) can help to identify a solution.
While I understand that more info might make diagnosis easier giving us some, any, examples would help get over the hurdles.
I’m getting frustrated failing to do really simple things. I want to put the results of a script into a field in a business variable - but the GUI will only let me have a “whole” business object. I just can’t see how to get it to set a single field.
To update a business variable attribute using the output of a script, in the operation definition, click on the “Takes value of” link and in the drop down list select “Use a Java method” and select the appropriate “set” method to update the attribute you want.
@antoine.mottier i cannot import your bos file. It says: this BOS archive is not valid.
I am also sending a simple bos file. The idea is to initialize the business variable empBusinessVariable.cn with the user’s name, and the empBusinessVariable.givenName with the aprocessVar, before Step1. And those values to be shown/ kept also at step2. https://www.dropbox.com/s/vu4nz8s6vxvxvru/MyTestDiagram1-1.0.bos?dl=0
Thank you for your interest.
@antoine.mottier problem solved. I am not using InstatiationForm. Instead, after start event i have created a service task (st1) and then a user task (ut1). In st1 i have created a groovy connector where i create a new object (obj1) of my BusinessVariable type. Then using the setters, I set the obj’s property with my processVariable value (in this script it should have been instatiated). Finaly i return the obj1. The output of the connector is used to initialize (initialize with) the BusinessVariable.
Thank you for your time.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.