Snippets

Adaptavist ScriptRunner for Jira Cloud Example Workflow Conditions

Updated by Kristian Walker

File ScriptRunnerforJiraCloudExampleWorkflowConditions.groovy Modified

  • Ignore whitespace
  • Hide word diff
 issue.subtasks.filter(subtask => subtask.status.name == '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
+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 => c.author.accountId == user.accountId).length > 0
Updated by Kristian Walker

File ScriptRunnerforJiraCloudExampleWorkflowConditions.groovy Modified

  • Ignore whitespace
  • Hide word diff
 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
+issue.subtasks.filter(subtask => subtask.status.name == '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
Updated by Kristian Walker

File ScriptRunnerforJiraCloudExampleWorkflowConditions.groovy Modified

  • Ignore whitespace
  • Hide word diff
 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)
+['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
Updated by Kristian Walker

File ScriptRunnerforJiraCloudExampleWorkflowConditions.groovy Modified

  • Ignore whitespace
  • Hide word diff
 // which  could be used as a reference guide to create workflow conditions. 
 
 
-// The example below mandates that an issue must have at least PDF attachment. 
+// 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
Updated by Kristian Walker

File ScriptRunnerforJiraCloudExampleWorkflowConditions.groovy Modified

  • Ignore whitespace
  • Hide word diff
 // The example below mandates that an issue must have at least PDF attachment. 
 issue.attachments.filter(attachment => attachment.mimeType == 'application/pdf').length > 0 
 
-// Specify that the current user must be in a list of users baased
+// Specify that the current user must be in a list of users defined using the accountId for each user
 ['accountIdHere', 'accountIdHere'].includes(user.accountId)
  1. 1
  2. 2
HTTPS SSH

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