I am trying to compare a value from a multiselect customfield. i did the following code:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.jira.issue.MutableIssue
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
def issueManager = ComponentAccessor.getIssueManager();
def userManager = ComponentAccessor.getUserManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def cField = customFieldManager.getCustomFieldObject("customfield_12032");
def cFieldValue = issue.getCustomFieldValue(cField);
if (cFieldValue.toString() == "Business Trips")
{
UserMessageUtil.error('Please select project.')
}
But the code only works when I put cFieldValue.toString() == "None". I can't seem to figure out why it doesn't work for the other options.
Hi @Ainee ,
It works a bit differently in cloud as the search functionality utilizes the Cloud API search.
Here's the documentation:
https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-jql-keywords-functions/search
Hope this helps. I would suggest contacting ScriptRunner support if you are looking into a specific function.
-Ben
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.