Hello,
I have the following script that I would like to use in "Script Fragments", provided by scriptrunner.
It's purpose is to prevent the "Move" issue button from appearing on the "More" option list, when a certain select list field has a certain value:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def ReqProject = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Requesting Project")
def ReqProjectValue = issue.getCustomFieldValue(ReqProject)
def project = issue.getProjectObject().getKey()
return !(ReqProjectValue == "Solution1" && jiraHelper.project?.key in ["TP"])
I'm not sure what the problem is, as it is not throwing any errors, but it also does not hide the "Move" option, for that project, when the field 'requesting project' has that certain value.
Please let me know if you have any suggestions.
Hi,
Script fragment does not seem really consistent.
However I had success on my end by not using return in the last line, and it worked after a few updates.
I would advise to store the condition in a variable and log it :
boolean condition = !(ReqProjectValue == "Solution1" && issue.getProjectObject().getKey() == "TP")
log.error("condition : " + condition)
condition
(Notice I changed the code for the project key, I don't know if that was an issue but this is working for me)
Then load a new issue on another project.
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.