Forums

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

Need groovy assistance to automate issue linking via post-function

Willis Towers Watson Atlassian Team September 30, 2020

We're looking for a way to automate the linking of issues via a workflow post-function. Specifically, we need to link the current issue to a ticket of a specific type where the value in a custom user picker field matches the value of the same custom user picker on the current issue. So the logic we're trying to express is something like:

project = "Example Project" and issuetype = "Example Issue Type" where "Custom User Picker" = (same as "custom user picker" of currentIssue)

I know that's not a real expression and it doesn't resemble groovy, but hopefully someone gets what I'm aiming at and can provide an idea or two. We'd _like_ to leverage the "Link issues to the current issue" post-function (JMWE) if possible because it'd be cleaner, but if we can't, we do have the Scriptrunner post-functions available to us.

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
September 30, 2020

Hi,

you can totally do this with the "Link issues to the current issue" post-function. The main configuration of the post-function is not a Groovy script but a (templated) JQL expression. Therefore, you could write something like:

project = "Example Project" and issuetype = "Example Issue Type" and "Custom User Picker" = "${issue.get("Custom User Picker")?.name}"

This JQL should return the issue(s) in the specific project and of the specific issue type that has the same "Custom User Picker" value as the current issue. You can "Test" the JQL expression to make sure it works before saving the post-function.

Hope this helps,

David 

Willis Towers Watson Atlassian Team September 30, 2020

Just confirms this works like a charm. Thanks for such a quick and helpful response, David.

Suggest an answer

Log in or Sign up to answer