You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.