Hi,
I need to fetch parent custom field value to compare with sub-task field value . To achieve that I was writing below code in sub task post function but no luck in getting parent issue . Getting null for below tried option . Kindly help to fix the issue in the code.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager;
Issue parentIssue = issue.getParentObject()
log.error("parentIssue = "+parentIssue) -->getting null
def parentId = issue.getParentId();
log.error("parentId = "+parentId) -->getting null
def parent = ComponentAccessor.getIssueManager().getIssueObject(parentId)
log.error("parent = "+parent) -->getting null
def myfieldName = ComponentAccessor.customFieldManager.getCustomFieldObjectsByName("myfield").first()
log.error("myfield = "+myfieldName)
def parentValue = parentIssue.getCustomFieldValue(myfieldName )
log.error("parentValue = "+parentValue)
def parentValue11 = parent.getCustomFieldValue(myfieldName )
log.error("parentValue11 = "+parentValue11)
def Mounts = customFieldManager.getCustomFieldObject("customfield_20610")
log.error("Mounts = "+Mounts.getValue(issue))