Hello,
I am trying to create an escalation service that will close tickets greater than 7 days, sets the resolution to completed and adds a comment. In the workflow, when the close button (transition) is selected, a transition screen pops up and prompts user to select resolution and a value. The field resolution is a of type select list. The value to set should be "completed" I would like to bypass the transition screen and automatically set the status as closed, resolution as completed.
The code I have is the following but it is not working. It mentions that
--------------------------------------------------------------------------------------------
Thank you.
The message means that a variable with that name is already "prepared" for your script! So I guess all you have to do is removing this line:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
and the error should disappear.
Also, note that you don't actually use the variable "customFieldManager" anywhere in the script, so this line was useless anyway!
Hi Aron,
Thanks for your reply. I tried to remove the line but still getting errors. Please note that I am placing this code in the console in escalation services.
The errors are as follow:
Cannot find matching method com.atlassian.jira.issue.customfields.manager.OptionsManager#getOptions(java.lang.Object). Please check if the declared type is correct and if the method exists.
[Static type checking] - Cannot find matching method com.atlassian.jira.issue.IssueInputParametersImpl#addCustomFieldValue(java.lang.Object, java.lang.String). Please check if the declared type is correct and if the method exists.
Possible solutions: addCustomFieldValue(java.lang.Long, [Ljava.lang.String;), addCustomFieldValue(java.lang.String, [Ljava.lang.String;), getCustomFieldValue(java.lang.Long), getCustomFieldValue(java.lang.String)
Please advise. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The OptionsManager class does provide a getOptions() method:
Groovy can't call it for some reason. Isn't this possible that your "cfConfig" variable is NULL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aron,
Thank you very much for your feedback and your guidance. After playing with the code for a bit, I think I got what I want. Basically when a user clicks on the closed button, it prompts for the required field resolution and I want to set that value to completed.
I updated it with the following and it works. What I'm confused is what is the difference between the above method getting the select list customfield: Resolution and performing a set value to: Completed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great work! Please accept my answer above if it guided you to the solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.