I would like to set up a post function on a workflow that transitions an issue to a different status if the priority is 'high' or 'emergency'.I have added a post function of type 'transition issue' and chosen 'conditional execution'
The project code is TSP. It's important that I include the code in the condition as other projects use this workflow. For the condition I've tried:
(issue.getProjectObject().getKey() = "TSP") && (issue.priority?.name == 'High'||'Emergency')
but it doesn't work. Can anyone help me to get the syntax of the condition right and this post function working?
At a casual glance, you want to replace "issue.priority?.name == 'High'||'Emergency'" with "['High','Emergency'].contains(issue.priority?.name)".
Or
issue.priority?.name in ['High','Emergency']
which reads a bit more like spoken language, to me.
Alas I have tried both:
(issue.getProjectObject().getKey() = "TSP") && (['High','Emergency'].contains(issue.priority?.name))
and
(issue.getProjectObject().getKey() = "TSP") && (issue.priority?.name in ['High','Emergency'])
I wonder is there some problem with the fact that the post function is on the create transition?
For anyone who stumbles on this, I eventually found the answer thanks to Innovalog support - the syntax that finally worked for me was:
issue.get("project").getKey().equals("TSP") && ["High","Emergency"].contains(issue.get("priority").name)
how can I get this same code to pick up the previous or previous status?
It looks like you're new here. Sign in or register to get started.