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.

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

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

Cheers

Dyelamos

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 11, 2018 in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

3,532 views 6 6
Join discussion

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