Forums

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

ScriptRunner: Post-Function with file path instead of inline script

Matt October 8, 2019 edited

I'm quite new to ScriptRunner, and am wondering how to have my post-functions take a file path to the script, rather than pasting inline script.

I need the same post-function script for transitions in several workflows, so I'd rather direct each to the file path of one script rather than pasting the same inline code for each.

That way, I can update the script once rather than for each workflow I've set it up for. 

When applying a custom groovy script post-function to a workflow transition, I'm met with the following menu - note the Script | File toggle over the code area isn't there!

Is there no way to give it a path to follow rather than always having to write inline script?

 

Edit: Well, sh*t, guess that's how new I am to this :p  

image.png

2 answers

1 accepted

1 vote
Answer accepted
Ravi Sagar _Sparxsys_
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.
October 9, 2019

Hi @Matt 

There is a field Script file just above the inline script.

Ravi

Matt October 9, 2019

Yup, I noticed as soon as I had posted this!

Sometimes there will be a script file field, other times there are the toggle buttons above the inline script area.

Would be nice if it was consistent, guess I just have to learn each form now!  

1 vote
Sebastian Krzewiński
Community Champion
October 8, 2019

Hi @Matt 

 

As I remember if you want move your script to files (IMHO this is a very good idea) you should put it in home directory.

More information you can find in other community posts:

- https://community.atlassian.com/t5/Adaptavist-questions/Need-to-know-the-file-path-in-server-level-where-the-Script/qaq-p/728856

- https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Where-do-I-place-A-ScriptRunner-script/qaq-p/797291

 

Regards,

Seba

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira service management, jsm webinar, ai in jsm, opsgenie integration, incident management, virtual agent, atlassian intelligence, ai-powered service desk, it operations, atlassian learning, service management webinar, team '25 recap

What’s new in Jira Service Management 🤔

Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.

Register here ⬇️
AUG Leaders

Atlassian Community Events