Adding a new watcher to the Jira Issue

Originally asked by Dewayne Lavelle on 06 July 2020 (original question)


Hello,

I need to automatically add a new watcher to issues that have been created from Exalate. How can I do that through the rules?

e.g. issue.watchers = “username"

I also want to filter what attachments are sync’d. Is this possible using some kind of regex match?

e.g. I don’t want to sync attachments that have a specific prefix.

Thanks!

-Dewayne


Answer by Dewayne Lavelle on 06 July 2020

André,

Thanks so much for the fast reply. Will startsWith work the same as endsWith?

e.g.

replica.attachments = issue.attachments.``findAll { attachment -> attachment.filename.startsWith(``"String_"``) }

Comments:

André Leroy-Beaulieu Castro commented on 06 July 2020

Hi Dewayne,

Could you try this:

replica.attachments = issue.attachments.findAll { attachment ->
!(attachment.filename.startsWith("String_")) }
Dewayne Lavelle commented on 13 August 2020

Andre, if I wanted to go the other route and only accept attachments that have a specific prefix how would I do that?

Answer by André Leroy-Beaulieu Castro on 13 August 2020

Hi Dewayne,

This should work to send only the attachments where the filename is prefixed with MGC_ for example:

replica.attachments = issue.attachments.findAll { attachment ->
attachment.filename.startsWith("MGC_")) }

Let me know how this goes!

Thanks,

André


Answer by Dewayne Lavelle on 13 August 2020

Andre, If I wanted to go the other way and only accept attachments with ‘MGC_’ prefix how would I accomplish this?


Answer by Dewayne Lavelle on 06 July 2020

Andre,

What about ignoring Attachments that contain a specific prefix?


Answer by Dewayne Lavelle on 06 July 2020

Actually I want to ignore attachments that match a specific prefix.


Answer by André Leroy-Beaulieu Castro on 06 July 2020

Hi Dewayne,

To set a watcher you can use the line:

Incoming Sync:

issue.watchers += nodeHelper.getUserByEmail("youremail@gmail.com")

in the following link you can also see an example on how to filter attachments by it’s body and filename:

https://docs.idalko.com/exalate/display/ED/Attachments+synchronization

Thanks,

André


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.