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

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.

Cheers

DYelamos

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

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

Cheers

Dyelamos

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

73 views 0 5
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