Example of a Grrovy Script

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 :slight_smile:

1 Like

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

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 :slight_smile:

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