Forums

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

User not in a group Condition

Ash
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 Leaders.
July 25, 2019

Hi All,

 

How to use user not in a group condition in post function.

Can someone help me with the snippet for Jira Cloud. We use both JMWE and Scriptrunner

 

TIA!!

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
July 25, 2019

Hi,

what do you mean by "condition in post function"? Are you trying to create a conditional execution script for a JMWE post-function? Or are you trying to create a workflow condition (not post-function)?

Ash
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 Leaders.
July 25, 2019

Hi @David Fischer 

Thank you for your reply. I'm trying  conditional execution script for a JMWE post-function. 

 

Condition should be like this "user not in a particular group"

 

If a user not in a group X then set the default value to the sprint field and to a custom field.

David Fischer
Community Champion
July 25, 2019

Try this:

{{not currentUser | isInGroup("administrators")}}
Ash
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 Leaders.
July 25, 2019

Thank you @David Fischer 

Carolina SILVA
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 Leaders.
March 31, 2021

hello do you mind giving the full example?

This line only returns 'true' result ;-( 

David Fischer
Community Champion
March 31, 2021

That line will return false if the currentUser (you if you are "testing" the expression) is not in the "administrators" group. I just tested it and it works.

Where are you trying to use it? In a JMWE post-function's Conditional Execution section?

Dan H
Contributor
September 23, 2022

This doesn't work at all for me, any ideas?

1.jpg

David Fischer
Community Champion
September 23, 2022

Hi @Dan H ,

Conditions and Validators don't use Nunjucks but Atlassian's Jira Expressions language (it's a limitation of Jira Cloud). The correct syntax in Jira Expressions is:

!user.groups.includes("administrators")
Like David VanDyke likes this

Suggest an answer

Log in or Sign up to answer