Setting BDM in script connector

1
0
-1

Hi,

How would one normally update the value of a BDM Business Variable within a groovy script connector?

I've tried:
myBusinessVariable.value = "";

and
myBusinessVariable.setValue("");

but neither seem to work.
Unfortunately I need to update 50+ variables like this, so using Operations is going to take a while to do, especially since each variable is going to need some processing done before being set. Ideally I want to be able to do this in a single script connector.

1 answer

1
+1
-1
This one is the BEST answer!

Your business variable should be a complex type with multiple fields. In the Groovy Script Connector, you should be able to get/set these fields using attributes like I think you suggested:

myBusinessVariable.field1 = "field1value"

If this does not work, you can try to return the businessVariable after edition from the script

return myBusinessVariable

and have an output operation to assign this returned value to your business variable as a whole.

HIH,

Comments

Submitted by gregory_1374915 on Tue, 07/24/2018 - 22:11

Your second solution did the trick. I had the script return an instance of the business variable and assigned the output to the original business variable.

It's odd that the first solution doesn't work. Possible bug?

Submitted by pierrick.voulet on Tue, 07/24/2018 - 22:19

Glad it worked!

Not really, you should see the connector execution as a detailed operation execution.

The reason is that Bonita does not want to allow data edition directly from Groovy Script expression which could be quite abstracted, the idea is to avoid future maintenance nightmare... Actually, having this output operation gives a good way to identify where data is edited which is much better for readability and maintenance.

HIH

Notifications