How can I get user action in a post function script

I would like to get a user action name (e.g. Create, Clone, etc.) inside a post function to alter workflow depending on the action. For instance:

  1. When a user clicks Create to create a new issue the post function script sets Description field to a specific value.
  2. When a user clicks Clone on an issue the post function script does not perform any actions.

Script Runner's Behaviours offers a predefined function to get action Name: getActionName().

2 answers

0 votes

Hello Bartosz.

I suppose you can create a Custom Script like this:

if (getActionName() == "Create Issue") {
issue.setDescription("Your new description")

This should work as is your Custom Script postfunction dialog.

If this isn't what you wanted, please let me know and expand your examples.



Thank you for your response, @Daniel Yelamos [Adaptavist]. The getActionName() function won't work inside custom script for post-function. Event the script editor does suggest this function is unavailable.

Screen Shot 2017-09-29 at 11.23.31.png

0 votes

Hi Bartosz

I'm sorry I pointed out to the wrong thing. As a matter of fact we have an article of this in our documentation that I totally overlooked.

Apologies once again, I hope this was what you were looking for



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,686 views 3 11
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