Can a post function check which project the workflow is running in?

p.noack@samsung.com December 30, 2016

I am trying to consolidate a large number of workflows which other than one or two things are identical.  One project likes to assign the assignee as a post function.  When the workflow was only for that project it was easy.  Now I would need to see if the workflow was happening for that project instead of any of the other four.  Is this something that script runner can do in a post function?

 

if project = 'xyz' then the assignee of the issue will be set to 'abc'

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 30, 2016

Indirectly, yes.

A post-function is part of a transition.   Transitions happen to issues.  Issues belong to projects.

So, issue.getProjectObject() will give you the project to work with (which you can then ask for key, name, and the other project details to feed into your assignee logic)

p.noack@samsung.com January 3, 2017

Can you point me to a sample script that would get me started on writing this post-function?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 3, 2017

I've already given you the code to get the project.  Have a look at https://docs.atlassian.com/jira/server/ for what you can do with it

p.noack@samsung.com January 4, 2017

This worked Thank you

Suggest an answer

Log in or Sign up to answer