Hi all,
I'm trying to build an Initializer script in Behaviours. I have one behaviour for different Customer Reuqest Types. What I want to get is that when issue is created (both by an agent and from user portal) depending on the Customer Request Type some fields are hidden in the initiallly loaded Create issue window.
I'm having troubles in fetching the current value of Customer Reuqest Type field for both the agent and when user creates via portal. So far I have the current code based on a mixture of some found code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.atlassian.servicedesk")
@PluginModule
RequestTypeService requestTypeService
def issue = event.issue
def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def customFieldManager = ComponentAccessor.customFieldManager
def requestTypeCustomField = customFieldManager.getCustomFieldObjects(issue).findByName('Customer Request Type')
log.warn("log-behaviour-hide-fields-colocation INITIALIZE customField value: " + customField)
but I'm stucked at this stage. The Scriptrunner checker print error "[Static type checking] - Cannot find matching method com.atlassian.jira.issue.CustomFieldManager#getCustomFieldObjects(java.lang.Object). Please check if the declared type is correct and if the method exists." so even doesn't allow me to proceed further.
Hod do I properly retrieve the current value of Customer Request Type when creating an issue?
I'm using Jira Software 8.22.4, Jira Service Management 4.22.4 and ScriptRunner v. 6.53
Thank you in advance