I have updated my jira to 8 and also script runner version. Our workflow conditions are stopped working
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;
import org.apache.log4j.Category;
import com.atlassian.jira.workflow.JiraWorkflow
JiraWorkflow workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue);
def wfd = workflow.getDescriptor()
def actionName = wfd?.getAction((int)transientVars["actionId"])?.getName();
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def cfStatusDdetails = customFieldManager.getCustomFieldObjectByName("Status details")
issue.setCustomFieldValue(cfStatusDdetails,actionName)
Error - .getCustomFieldObjectByName("Status details")- Method doesn't exist. Replaced with suggestion method by getCustomFieldObjectsByName
Once i updated suggested method. It is failed in this line.
issue.setCustomFieldValue(cfStatusDdetails,actionName)
Error i am getting attached in screen shot
getCustomFieldObjectsByName returns you a list of custom field objects, so if you are sure there exists one you should use getCustomFieldObjectsByName("field name")[0]
Hello @Business Process Consulting
You have to fetch the custom field by "id" or by if you use byNames as shared by @Ilya Turov then you will get a list and you will need to get the first element by calling "list.first()" on the returned list.
If you fetch custom field by id then that's the best way as it's agnostic to the custom field name
customFieldManager.getCustomFieldObject("customfield_10005")
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.