Example of a Grrovy Script

1
+1
-1

Hi,

Is there any example of how to use saved Groovy Script in the community ?
I've searched in my BPAD and Advanced trainings docs, and on http://documentation.bonitasoft.com/using-expressions-and-scripts-0 but I don't really understand how to use it.

Can someone show me how to declare a static function in groovy ? Because every function I tried to make is returning NULL.

Thank you :)

1 answer

1
0
-1
This one is the BEST answer!

Go to Development->Manage Groovy Scripts

Create a script with a name ABCXYZ, here is a sample

/**
 'comments
*/

def static getText(){
        return "this is my text";
        }

Then in your connector you can do this:

def x = ABCXYZ.getText()

There you go

regards
Seán

PS: if this fixes your issue, please mark as Resolved

Comments

Submitted by p.clainchard on Mon, 12/07/2015 - 15:54

In fact it might have worked with what I did, but when I click on the "Evaluate" button it still gives NULL.
But when you test it on a connector the evaluation is working.

Thank you anyway :)

Submitted by Sean McP on Mon, 12/07/2015 - 19:25

yeah, one thing I learnt early on is "eevaluate" is near useless and don't rely on it at all...

Glad to help,
regards
Seán

Notifications