Hi,
I am trying to follow an example from the ScriptRunner's manual ("Select Lists with Other") and get a field object:
def componentField = getFieldByName("product_component")
I paste it to the script console and immediately get an error, "Cannot find matching method".
Shall I import some library?
I added the following imports:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField def componentField = getFieldByName("product_component")
but it did not help.
Please assist.
Thanks,
Alex
You can only use getFieldByName and the various other methods in the documentation in that section with the behaviours functionality.
If you need to get a custom field from the Script Console you should use:
import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.getCustomFieldManager() def issueManager = ComponentAccessor.getIssueManager() def issueKey = "TEST-1" def issue = issueManager.getIssueObject(issueKey) def productCf = customFieldManager.getCustomFieldObjectByName("product_component") def productValue = issue.getCustomFieldValue(productCf)
Hope this helps.
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.