Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to use IF...then within workflow transaction

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

As @Robert Wen 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:

0 votes
Answer accepted
Robert Wen Community Leader Nov 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 Nov 29, 2021

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

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

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you