How can I get user action in a post function script

Bartosz Czerwiński August 31, 2017

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
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2017

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

0 votes
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2017

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

Bartosz Czerwiński September 29, 2017

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events