Script runner conditional email

Hello,

I've currently got a script where when a new attachment is uploaded, it emails reporter, assignee, and watchers.

One thing we've noticed is that if you add the attachment and set security on it (administrators only for example), it will still email the reporter, assingee and watchers even though maybe only the reporter and some watchers are part of said security group.

How would I go about creating a condition where it will only send out an email if there is no issue security on it?

Current script:

Condition:

attachmentManager.getAttachments(issue) && changeItems.any {it.get('field')=='Attachment'}

Email template

: This ticket has one or more new attachments.

New attachments will be attached above. Latest attachment uploaded by $currentUser

Click here to view ticket: ${baseUrl}/browse/$issue.key

To issue fields: assignee reporter watchers

Many thanks!

1 answer

1 accepted

1 vote

Probably the best thing is to file an RFE against the script runner project. Probably any recipient without browse permission to the issue should be dropped.

To check for no security add this to your condition:

&& ! issue.securityLevel

Hmmm, doesn't seem to work. We are using comment security in this particular case, rather than issue security.

Would this cover that at all?

I (now) know that JIRA doesn't support attachment security unless you do full issue security, so that's a bit of a bummer, and we've resigned to the fact that it's not an included feature.

Thank you!

Comments, no, that's something different from issue security.

> One thing we've noticed is that if you add the attachment and set security on it (administrators only for example)

Yes, I misunderstood what you were saying here... what you are probably doing is setting comment-level security. This has no bearing on the attachment, even though you may have done it through the same dialog.


Thank you very much!

The previous condition will definitely help in other area, so very useful :)

Thanks!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

137 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you