Hi Team,
I am trying to add warning message using post function. But this warning message should be visible if there is no subtask ticket for parent issue. If there is any subtask tickets it should not give warning message. Can you help me to write condition for that
Welcome to the Atlassian Community!
Post-functions can not give you warning messages, they are not connected to the UI at all. The best you could do would be to create a comment on the issue that highlights that the user has done something wrong.
You might be able to do something with conditions, listeners, automation or validators though.
Could you tell us what the actual requirement is? In the sense of where it should happen? Is the warning for issue view? Or you want to tell people about it during a transition? Or something else?
Hi @priym ,
Something along the line of :
import com.atlassian.jira.component.ComponentAccessor
def subtaskManager = ComponentAccessor.getSubTaskManager()
def subtasks = subtaskManager.getSubTaskObjects(parentIssue)
if (subtasks.isEmpty()) {
// Add your warning message code here
// For example:
issue.setCustomFieldValue(warningField, "No subtask tickets found for this issue.")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is code for Server, the question was about Cloud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.