I have a screen with a cascading select list called "Root Cause", if the second list = to "Cannot Reproduce" I want to set the Resolution field to "Cannot Reproduce" automatically for the user. I'm having trouble with reading the values in the Root Cause field though. I'm using Behaviours in Script Runner to accomplish this. I have the script on the Root Cause field.
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION
def rootCause = getFieldByName("Root Cause")
def rcVal = rootCause.getFormValue() as Map
if (rcVal.get("1") == "Cannot Reproduce")
{
//This part works, the if statement doesn't
def constantsManager = ComponentAccessor.constantsManager
def allowedResolutions = constantsManager.resolutions.findAll
{
it.name in ["Cannot Reproduce"]
}
getFieldById(RESOLUTION).setFieldOptions(allowedResolutions)
}
Hi Pascal,
To clarify Ravi's answer - Scriptrunner will allow you to archive issues, but the pre-requiste is that you're on Jira Data Center. Jira Server does not permit the archiving of issues/projects.
One potential solution on Jira Server is to create an empty project with the appropriate permissions, and then move issues into this project with Scriptrunner. Beware that the issue keys will change as they're in a different project. You can read more on archiving before archiving was a thing here - https://confluence.atlassian.com/jirakb/archiving-a-project-in-jira-server-950287459.html
I believe you'd do something like what's in that link, but you'd use the ArchivedIssueService instead of the one for projects to archive individual issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Thanks for the Info :)
I have gone through the link. My question is "As per the Scriptrunner documentation we can archive the filtered issues as per the scheduled Job but where these archived issues will get saved and how to retrieve if needed in future".
Your response will help us a lot and appreciate it. Thanks!!
Regards
RK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.