Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Use a file on the Script Editor as a Post Function script

Daniel Alonso
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.
January 22, 2020

I have script that I need to reuse on a lot of Workflow Post-functions, so I decided to move it to the Script Editor, but now I'm having a syntax issue on this part:

def project = issue.getProjectObject()

#Error: The variable 'issue' is undeclared.

But my 'issue' is the current is which triggered the action.

How can I update this script to make it work as a Post-function?

1 answer

0 votes
Payne
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.
January 22, 2020

Since you're editing your script outside the context of being a post function, the compiler doesn't know what issue is. When it runs as a post function, though, issue will be defined. So, you can ignore the static type checking error while editing the script. I have one like this, and it runs fine.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events