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

**URL:** https://community.ofelia.com/t/creating-create-groovy-script-for-access-in-user-defined-functions-of-script-editor/4345
**Category:** Q&A
**Created:** [22 March 2014 21:16 UTC](https://community.ofelia.com/t/creating-create-groovy-script-for-access-in-user-defined-functions-of-script-editor/4345 "2014-03-22T21:16:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![guillaume.ridoux](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@guillaume.ridoux](https://community.ofelia.com/u/guillaume.ridoux)
#### Post date: [22 March 2014 21:16 UTC](https://community.ofelia.com/t/creating-create-groovy-script-for-access-in-user-defined-functions-of-script-editor/4345/1 "2014-03-22T21:16:18Z")

</div>

Hi,

I am creating a groovy&nbsp;function below&nbsp;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&nbsp;function list of the groovy script expression editor. I can't see my function in the&nbsp;user defined category at the moment.&nbsp;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])  
 {  
 &nbsp;pid, ps, m -\>  
 &nbsp;process\_id=pid  
 &nbsp;process\_status=ps  
 &nbsp;message=m  
 }  
 sql.close()  
 return message  
 }

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

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)
#### Post date: [30 March 2014 04:23 UTC](https://community.ofelia.com/t/creating-create-groovy-script-for-access-in-user-defined-functions-of-script-editor/4345/2 "2014-03-30T04:23:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![guillaume.ridoux](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@guillaume.ridoux](https://community.ofelia.com/u/guillaume.ridoux)
#### Post date: [8 April 2014 09:56 UTC](https://community.ofelia.com/t/creating-create-groovy-script-for-access-in-user-defined-functions-of-script-editor/4345/3 "2014-04-08T09:56:35Z")

</div>

Thanks

---

<div class="post-metadata">

### Author: ![dimtirios.k](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@dimtirios.k](https://community.ofelia.com/u/dimtirios.k)
#### Post date: [3 September 2014 19:19 UTC](https://community.ofelia.com/t/creating-create-groovy-script-for-access-in-user-defined-functions-of-script-editor/4345/4 "2014-09-03T19:19:30Z")

</div>

life savior
