how to use IF...then within workflow transaction

Manon Bourgeois November 29, 2021

Hello,

I'm trying to create a condition in a workflow but I can't figure out how & where.

This is what I'd like to achieve:

If reporter is in project role ''X'' then only user within  project role ''Y ''can execute the transaction.

Tks for your help

4 answers

3 accepted

0 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2021

As @Robert Wen_ReleaseTEAM_ and @Jack Brickey correctly point out, you will need some kind of add-on.

The condition you're seeking will not actually be created with a script, but through Jira Expressions, as this is how Jira Cloud implements conditions.

Add-ons like ScriptRunner, JMWE, JWT, Cloud Workflows, and Power Scripts all use Jira Expressions and have different interfaces to help you build your own (or in some case have templates/recipes/etc.)

I've written a quick introduction to Jira Expressions here:

https://community.atlassian.com/t5/Jira-articles/Jira-Expressions-But-Why/ba-p/1694545

In the JMWE "Use cases for conditions", I found this example which might give you a start:

Manon Bourgeois November 30, 2021

tks

0 votes
Answer accepted
Robert Wen_ReleaseTEAM_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2021

I think for what you're trying to achieve, you're going to have to make sure you have an app that accepts scripting such as Scriptrunner.  That then gives you an option to select the script when you select the Condition link when editing a Transitition.

0 votes
Answer accepted
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2021

to do this within the workflow you would need an addon, e.g. JWME, Scriptrunner. etc.

1 vote
Frank Leclerc _Decadis AG_ November 30, 2021

Hi @Manon Bourgeois ,

as Darryl has already written, you will currently only be able to implement this in conjunction with an additional app.

Unfortunately, I can only tell you whether this can be implemented with Jira Workflow Toolbox (JWT). However, this use case can be implemented without any problems, as far as I have understood correctly.
For this you can use a Jira expression condition from JWT:
issue.reporter.getProjectRoles(new Project(issue.project.id)).map(p => p.name).includes("X") ? user.getProjectRoles(new Project(issue.project.id)).map(p => p.name).includes("Y") : true

You can find our documentation on Jira expression mode at: Documentation Jira Workflow Toolbox Cloud - Jira expression mode 

If you have further questions, don't hesitate to contact us via xApps Support Portal .

Cheers,
Frank

Manon Bourgeois November 30, 2021

thank you!

Like Max Foerster - K15t likes this

Suggest an answer

Log in or Sign up to answer