Adaptavist ScriptRunner for Jira Cloud Example Workflow Conditions

Created by Kristian Walker last modified
 * This script provides some example expressions which can be added as 'ScriptRunner Script Conditions* inside of ScriptRunner for Jira Cloud'.
 * The conditions must written as a Jira Expression using the expression framework which Atlassian document at:
 * All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner 
 * license shall be granted a  non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed
 * or amended and must be included in any circumstances where the code snippet is shared by You or a third party." 

// We also have some example conditions for script listiners  at 
// which  could be used as a reference guide to create workflow conditions. 

// The example below mandates that an issue must have at least one PDF attachment. 
issue.attachments.filter(attachment => attachment.mimeType == 'application/pdf').length > 0 

// Specify that the current user must be in a list of users defined using the accountId for each user
['accountIdHere', 'accountIdHere'].includes(user.accountId)

// This example mandates that an issue must have at least one subtask
issue.subtasks.length > 0  

// This example mandates that all subtask issues must be in the 'Done' status
issue.subtasks.filter(subtask => == 'Done').length == issue.subtasks.length

// This example mandates that all subtasks have an assignee set
issue.subtasks.filter(subtask => subtask.assignee != null).length == issue.subtasks.length 

// This example mandates the current logged in user must of added at least one comment to the issue
issue.comments.filter(c => == user.accountId).length > 0

Comments (0)


You can clone a snippet to your computer for local editing. Learn more.