Good day,
For a ScriptRunner Behaviour on a field change, I try to extract the values of a custom field Parent Link (key: com.atlassian.jpo:jpo-custom-field-parent).
I want to check if a value is already set in the create screen and if the issue is linked to a parent on the edit screen or if the field has a value in the edit screen itself.
So far I try to access the field like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
def customFieldId = "customfield_14701"
def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(customFieldId)
log.error('key: ' + customField.getCustomFieldType().getKey()) -> return com.atlassian.jpo:jpo-custom-field-parent
I'm not sure if I understand the question correctly, but to get the value of that Custom Field you simply could use the Issue objects "getCustomFieldValue()" method (see https://docs.atlassian.com/software/jira/docs/api/9.10.0/com/atlassian/jira/issue/Issue.html#getCustomFieldValue-com.atlassian.jira.issue.fields.CustomField- )
issue is the binding variable in Behaviours, it can be used like
def customFieldId = "customfield_14701"
def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(customFieldId)
def customFieldValue = issue.getCustomFieldValue(customField)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.