Groovy runner: call a script in aother script

Dear all,

We are working with JIRA 4.4 and groovy runner 2.0.7. We succeed to do some scripts but now I try to call a function developped in a Script to use it in another script.

For example, I try to develop a script to initialize a date into fields:

package util
 
public class SetFieldToCurrentDate{
public static void setDate (String customFieldName){ Issue myIssue = issue FunctionHelper.updateCustomFieldDate(myIssue,customFieldName,UtilDateTime.nowTimestamp(),false) }
}


And I try to call this function in another script:

import util.SetFieldToCurrentDate
 
SetFieldToCurrentDate.setDate("Réception");

but I encounter an error log:
 unable to resolve class util.SetFieldToCurrentDate

Please, could you help me to understand why it doesn't run...

2 answers

0 vote

I would try to update, both JIRA and the plugin, has all this kind of thing works well in recent versions. 

But for one thing your code doesn't look valid, apart from it's all on one line, this looks wrong:

Issue myIssue = issue FunctionHelper.updateCustomFieldDate

In old versions the utility class would need to be on jira's classpath, IIRC. Like I say, best to update if at all possible.

 

Hi Jamie,

We will migrate in JIRA 6.x next year, but for the moment it isn't possible.

 

So I would like find another solution. It isn't possible with this version to call a function of one groovy script in another groovy script?

 

Best regards,

Céline

As I said: In old versions the utility class would need to be on jira's classpath, IIRC that is, copy it under web-inf/classes, according to the package.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

182 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you