Groovy Script silently does nothing, I don't know where the logs are to diagnose. is there a log created for groovy errors?
The value of field Supplier Re-evaluation Date of the current issue will be set to the result of a Groovy expression (replacing existing values).
import static java.util.Calendar.YEAR;
def year = new Date();
if(issue.get("Priority")=="Critical")
{ def year = today[YEAR] + 1 }
else if(issue.get("Priority")=="Major")
{ def year = today[YEAR] + 2; } else if(issue.get("Priority")=="Minor"){ def year = today[YEAR] + 2; }
else if(issue.get("Priority")=="Trivial")
{ def year = today[YEAR] + 3; }
else
{ def year = today[YEAR]; }
year.format('dd/MMM/yy');
Return year;
Forget MutableIssue tip, and replace Return with return
updated script: only errors on line #1
MutableIssue issue = binding.variables.get("issue") as MutableIssue ?: com.atlassian.jira.component.ComponentAccessor.issueManager.getIssueObject("QS-63883") import static java.util.Calendar.YEAR; def year = new Date(); if(issue.get("Priority")=="Critical"){ year = today[YEAR] + 1 } else if(issue.get("Priority")=="Major"){ year = today[YEAR] + 2; } else if(issue.get("Priority")=="Minor"){ year = today[YEAR] + 2; } else if(issue.get("Priority")=="Trivial"){ year = today[YEAR] + 3; } else { year = today[YEAR]; } PrintIn year.format('dd/MMM/yy');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please forgive me I am a beginner in groovy & Jira. if I am mixing languages, please let me know. I am working in Jira on a transition, attempting to run a groovy script to take the input of a field at release(priority) & add to today's date by year based on that & fill a referenced field in the current document with a date.
my transition type: "The value of field (field name) of the current issue will be set to the result of a Groovy expression (replacing existing values)."
here is the error that I get running the script in "script console"(original script)
@ line 15, column 8. Return year; ^ Script2.groovy: 15: unable to resolve class Return @ line 15, column 8. Return year; ^
errors adding mutuableissue line:
@ line 16, column 8. Return year; ^ Script6.groovy: 1: unable to resolve class MutableIssue @ line 1, column 14. MutableIssue issue = binding.variables.get("issue") as MutableIssue ?: com.atlassian.jira.component.ComponentAccessor.issueManager.getIssueObject("QS-63883") ^ Script6.groovy: 1: unable to resolve class MutableIssue @ line 1, column 53. inding.variables.get("issue") as Mutable ^ Script6.groovy: 16: unable to resolve class Return @ line 16, column 8. Return year;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your script is failing - you cannot overwrite year with another def. Remove all defs, but the first.
Try your script in Script Console with following snippet at the beginning to work with existing issue (replace key XYZ-333):
MutableIssue issue = binding.variables.get("issue") as MutableIssue ?: com.atlassian.jira.component.ComponentAccessor.issueManager.getIssueObject("XYZ-333")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All true, but this: issue.get("Priority") is only valid with JWME afaik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, definitely it is from JMWE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think this question is actually about JMWE and not script runner, you might want to change your tags.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is information related to groovy logging:
https://jamieechlin.atlassian.net/wiki/display/GRV/Script+Runner#ScriptRunner-Logging
Typically, you see the logging for groovy in the <JIRA-HOME>/log/atlassian-jira.log file. Please reference this link for adjusting the logging level for your goovy scripting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.