I am trying to transition an issue only if comment is added via email listener and comment author is matching custom field on that issue.
So I have noticed when JIRA is listening for emails and adds a comment from email the issue commented event does not fire, so instead I use issue updated event. But this condition for some reason always evaluates to false and transition does not happen.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
def commentManager = ComponentAccessor.getCommentManager()
def comments = commentManager.getComments(issue)
def approver
def author
if(getCustomFieldValue("Access Approver")){
approver = getCustomFieldValue("Access Approver").toString()
}
author = comments.last().authorApplicationUser.toString()
if(author == approver){
return true
}
else {
return false
}
If I test the two field separately the returned string is the same so the condition should evaluate to true.
What am I doing wrong here