Groovy Script in output field operation in 6.2

1
0
-1

Hi,

I m trying to migrate from 6.0.o to 6.2.5.

In 6.0, in a output operation data field i have a process (object) variable modfied through a setter:

p_solicitud.setProyecto(field_proyecto);
return "";

It returns a String to a String process variable. This does works in 6.0 (p_solicitud is actualized).

In 6.2, it doesn t work, p_solicitud isnt actualized.

Re-typing the code doesnt solve the problem,

What do i miss ?

Bes regards

2 answers

1
0
-1

nsaintaubert,

If dont understand wrong, you want to set the content of one field into a complex java object.

If this is the case, you should do the following Inside the Groovy script:

p_solicitud.setProyecto(field_proyecto);
return p_solicitud;

And in the output variable you add "p_solicitud"

It helps?

As note, this variable name ... Si quieres puedes escribir en español...

Un saludo

Comments

Submitted by nsaintaubert on Mon, 03/31/2014 - 17:12

And what if i want to change two process object (p_solicitud and p_sollicidud_desglose) ? cant return the two objects... Español, Ingles, frances you decide ,-)

Submitted by Pablo Alonso de... on Mon, 03/31/2014 - 17:17

If you really want to do that, this is not the case about a form. If you want to update one variable from a operation, a form field, etc you can do as I explain before but in other cases like groovy connectors you can update the value using the API (http://documentation.bonitasoft.com/javadoc/api/6.2/org/bonitasoft/engin...(long, java.util.Map) )

BUT, In which case do you want to update both variables? if it is in one field... may be you should think again about doing that, you are duplicating data in the process...

Submitted by nsaintaubert on Mon, 03/31/2014 - 17:37

Groovy connectors do not access the form fields. So i would have to duplicate all the form fields in activity-local variables. Why having 2 objects updated ? The one storing the value and the other infering a different behaviour to a second object (as using factory pattern to instanciate the adecuate class depending on the field value...) used in the process model; a single field may imply more than only a storage operations... so im not currently duplicating any value.

1
-1
-1

Hi,

In 6.2, you can not modify the process or activity data value directly in a groovy script. You can use a groovy or custom connector or an operation to modify the value of a process data.

Hope it helps

Comments

Submitted by nsaintaubert on Mon, 03/31/2014 - 16:21

Hi yhon,

thanks for answering. Is that a normal (and future) feature or only a bug in 6.2 ? Because it is really confusing amd annoying not having java object support in groovy scripts !!! Process and aplication data model are better reflected by java objects than java primitive or derivates (Float, String....) which are pleasly used in demos but not in real world.. Not supporting java object datamodel in groovy is an impotant loss in terms of funccionality (in term of process and aplication desgin); i fear we may not update the bonitasoft and change of BPM engine...

Nicolas - See more at: http://community.bonitasoft.com//answers/groovy-script-output-field-oper...

Notifications