Creating Create Groovy script for access in user defined functions of script editor

1
0
-1

Hi,

I am creating a groovy function below from Development->Manage Groovy script...->Create... and the function runs properly although it returns NULL.

Now I would like to have access to that function in the function list of the groovy script expression editor. I can't see my function in the user defined category at the moment. How does this work?

import groovy.sql.Sql

def function_name(p_SCENARIO_ID){
def process_status =""
def process_id =-1
def message = "no run"

def sql = Sql.newInstance("jdbc:oracle:thin:@LOCALHOST:1521:ORCL", "username", "pwd", "oracle.jdbc.driver.OracleDriver")
sql.call("{call Package_name.test_procedure_in_out(?,?,?,?)}", [p_SCENARIO_ID,Sql.VARCHAR,Sql.INTEGER,Sql.VARCHAR])
{
pid, ps, m ->
process_id=pid
process_status=ps
message=m
}
sql.close()
return message
}

I'm using Bonita BPM 6.2.2 Community on Tomcat 6/windows 2008R2 JRE6.

1 answer

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

Hi,

the function need to be declared as static (and with correct visibility, preferably public)

Regards,

Comments

Submitted by guillaume.ridoux on Tue, 04/08/2014 - 11:56

Thanks

Submitted by dimtirios.k on Wed, 09/03/2014 - 21:19

life savior

Notifications