Hi, i have a Script Listener in Groovy, my script check value of labels in created issue and set another custom field value when labels value is not 'from_email'. When I create issue from Jira menu and set labels value as 'from_email' it's work and custom field is not set. But when i create issue from email and JEMH set labels as 'from_email' it's dosn't work and custom field value is set. I don't know where is problem, it's JEMH problem? Or mayby Jira doesn't reindex issues from email corectly.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.issue.util.IssueChangeHolder;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
def issue = event.getIssue()
def projName = issue.projectObject.name
def label = issue.labels
def labelMgr = ComponentAccessor.getComponent(LabelManager)
def containsLabel = "from_email" in issue.getLabels()*.label
def CFM = ComponentAccessor.getCustomFieldManager()
def crmContacts = CFM.getCustomFieldObjectByName("CRM Contacts")if (!containsLabel)
{
switch (projName){
case 'PROJ1':
Issue myIssue = event.getIssue()def changeHolder = new DefaultIssueChangeHolder();
crmContacts.updateValue(null, myIssue, new ModifiedValue(myIssue.getCustomFieldValue(crmContacts), '(356,)'), changeHolder);
myIssue.store()
break;
case 'PROJ2':
Issue myIssue = event.getIssue()def changeHolder = new DefaultIssueChangeHolder();
crmContacts.updateValue(null, myIssue, new ModifiedValue(myIssue.getCustomFieldValue(crmContacts), '(10)'), changeHolder);
myIssue.store()
break;}
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.