Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

JMWE Post Function Conditional on User Group (cloud)

Hi team! 

I'm my trying (quite unsuccessfully) to execute a Conditional Post Function based on the reporter's "Group" which I have set here: Site Administration > User Management > Groups

  • Reporter's user Group = Analyst
  • Component/s = Acquisition

Can someone please help with how to construct the Nunjunks template? 

chris

2 answers

1 accepted

1 vote
Answer accepted

Try:

{{ issue.fields.reporter | isInGroup("Analyst") }}

But I don't see what the Component/s field has to do with anything here...

Thank you David.  I thought I'd given this syntax a test run to no avail.  must not have.  cheers!

@David Fischer _Innovalog_ - I am trying to accomplish the same thing, but I get this error. We are using server, not cloud.  

{{ issue.fields.reporter | isInGroup("Jira Portfolio Management Team") }}

 

Message:
Compilation error(s):
script15608722462601634036350.groovy: 1: Ambiguous expression could be either a parameterless closure expression or an isolated open code block;
   solution: Add an explicit closure parameter list, e.g. {it -> ...}, or force it to be treated as an open block by giving it a label, e.g. L:{...} @ line 1, column 1.
   {{ issue.fields.reporter | isInGroup("Jira Portfolio Management Team") }}
   ^

@SMAtlassianMber JMWE for Jira Server uses Groovy, not Nunjucks.

On Server, you want this:

 issue.get("reporter")?.isInGroup("Jira Portfolio Management Team")
Like David likes this

Hi,

I'm on Server and want to execute a condition based on the name of a group or a role, please help.

Thanks,

John

Hi John,

the example right above your question is for Server.

What do you mean exactly by "want to execute a condition based on the name of a group or a role"? Do you need conditional execution of a post-function? Or a workflow Condition?

Hi David,

Thanks for responding!

I want to execute a post function to send an email to Slack upon "Create". The condition is only to allow a group of users. I can create this group or I can create a role and assign these users to it, which way is better?

Ex. So if the Reporter role is "Developers", can the script be as below?

issue.get("reporter") == "Developers"

Thanks,

John

Hi David,

Since the group is small enough, I was able to implement using the below condition:

issue.get("reporter") == "user id 1";"user id 2"...

Thanks,

John

I was able to get this to work instead 

Scripted (Groovy) Validator (JMWE add-on)' Validator

ComponentAccessor.getGroupManager().isUserInGroup(currentUser, "Jira Portfolio Management Team")

Thanks. It helped me

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

287 views 2 5
Read article

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