Folks,
I'm trying to set a custom field based on the link type. I'm able to set the linked key through listener. However, I'm unable to clear it when the link is removed. Below is the code snippet. Please assist.
if (it.type.inward == 'is a defect of'){
logger.info("Inward is a defect of links: "+ it.inwardIssue.key)
def result = put("/rest/api/3/issue/${issue.key}") .header('Content-Type', 'application/json')
.body([
fields: [ customfield_14268:it.inwardIssue.key ] ]) .asString()
}else if(it.type.inward == null){
def result = put("/rest/api/3/issue/${issue.key}") .header('Content-Type', 'application/json') .body([ fields: [ customfield_14281: '' ] ]) .asString()
}