Snippets

Adaptavist ScriptRunner for Jira Cloud Example Workflow Conditions

You are viewing an old version of this snippet. View the current version.
Revised by Kristian Walker 354e0f2
/*
 * 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: https://developer.atlassian.com/cloud/jira/platform/jira-expressions/
 * 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 http://scriptrunner-docs.connect.adaptavist.com/jiracloud/script-listeners.html#_evaluate_condition 
// 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 => subtask.status.name == 'Done').length == issue.subtasks.length
HTTPS SSH

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