Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Error message didn't shown to issue with subtasks



I have a listener 'issue updated' that catch the event of changing issue type, check some fields of the issue, and display an error message.

This code worked ok, Instead a scenario which the issue has subtask.

I put logs inside the code, and I can see the UserMessageUtil.error line is read but isn't display in the issue view..

This is my code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.mail.Email;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.jira.ComponentManager

Issue issue = event.getIssue()
def issueType=issue.getIssueType().name;
IssueManager issueManager = ComponentAccessor.getComponent(IssueManager.class)

def sub = issue.getSubTaskObjects();
log.warn sub
def SubIssue = ComponentAccessor.getIssueManager().getIssueObject(sub[0].toString());
log.warn SubIssue
def issueCur= SubIssue.getParentObject();
log.warn issueCur;
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "issuetype"}
log.warn change;
def newString = change.newstring;
def oldString = change.oldstring;

log.warn newString
log.warn oldString

//old type is Bug-Customer
if((newString.toString()=='Story' || newString.toString()=='Bug-Internal' || newString.toString()=='Doc Story' || newString.toString()=='Integration'
|| newString.toString()=='QVR' || newString.toString()=='Epic' || newString.toString()=='UX Story' || newString.toString()=='Feature'
|| newString.toString()=='Theme') && (oldString.toString()=='Bug-Customer'))
log.warn 1;
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def Salesforce = issueCur.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_14309"));
log.warn Salesforce

log.warn 5
UserMessageUtil.error("<div style='color:red;'><b>Your move has changed the Issue Type for an Issue that has an external Salesforce ID to an Issue Type that is not synchronized with Salesforce and should not have a Salesforce ID.<br>Please contact a Jira administrator for more information.</b></div>");
log.warn 55




0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events