Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Expressions in Workflow Validators

perla.miranda
Contributor
August 19, 2022

I'm having an issue with Jira Expressions. I'm unclear on how to use if statements.

Goal: I've got an issue type of "Groundwork" that uses a workflow that is standard for all subtasks. When this groundwork status is updated to "Complete", I want to check that all sibling subtasks are assigned (because this is just part of the responsibilities for the person who completes the groundwork task). If any are Unassigned this transition should fail.

Steps Taken:

Problem:

  • I'm unsure how to really use functions or if statements in Jira Expressions. I'm getting the following error and I'm unsure how to translate this into Jira Expressions. Error: "Jira expression failed to parse: line 3, column 1:\nexpression expected, reserved keyword 'if' encountered."
passesCondition = true

// if issue is groundwork type
if (issue.issueType.name.match('^(Groundwork)$') != null) {

// get parent
parentIssue = issue.parent

// get subtasks
def subTasks = parentIssue.getSubTaskObjects()

// for each subtask
subTasks.each {
// if not assigned
if (it.assignee == null)
passesCondition = false
}
}
passesCondition

Questions:

1. How can I translate the code above to Jira Expressions?
2. Are there any other alternatives, without Jira Automation?

validators.png

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 8, 2017

It is not an option in JIRA yet. However, latest version of Bitbucket server is coming with webhooks. You might be able to take advantage of it and push the story to another status by triggering a REST call from Bitbucket server on PR approval.

Haven't tried it yet but worth checking.

Sowmya Srinivasapura Devaraja
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 19, 2018

Has anybody tried using REST calls for getting a trigger in Jira on Pull Request approval ?

Deleted user
September 20, 2018

Hi @Sowmya Srinivasapura Devaraja and @Jobin Kuruvilla [Adaptavist],

Do you guys have any example of those Bitbucket REST calls?

 

Thanks
Carlos

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events