User defined groovy functions in operations

1
0
-1

Hi,

I have created a new groovy class and accessed the functions inside the operation tabs as follows.

Groovy Class :

package com.company.userderfined

class MyClass {
static def myMethod(String input) {
return "Hello ${input}"
}

def myMethod1(String input) {
return "Hello ${input}"
}
}

Calling Methods:

import com.company.userderfined.MyClass

MyClass m = new MyClass()
m.myMethod1("a")

The above is works fine for me. But I want to define a groovy script like follows and call all the methods in side the operation tab.

function.groovy:

package com.company.script

def myMethod1(String input) {
return "Hello ${input}"
}

How to call this myMethod1 inside operation scripts.

import com.company.script.function

def x = myMethod1("A") is not working for me.

No answers yet.
Notifications