Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

File name not showing in post function

Sigursteinn BJarni Húbertsson August 5, 2020

Hello all!

I'm using script runner to send out custom emails in post functions.

I store this script on the server file system under jira.home.

When I create this post function, there is no problem to choose the file from the file system and the post function works as desired.

Hoooowever, when I want to edit the post function, there is no reference to the file or where it's located on the file system.

Here is a screenshot when I try to edit the post function.

It makes no difference whether I choose SCRIPT or FILE I always get the Inline script. 


image.png

Hopefully someone has figured this out!

P.S, The Jira version is 8.2.5

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Peter-Dave Sheehan
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.
August 5, 2020

Hi Sigursteinn

The SCRIPT tab is used only when you want  to keep  your script in-line and store it in the workflow (it's embedded in the workflow and can be exported with the xml)

The FILE tab is used to tell the workflow which file on your filesystem contains the script. The workflow definition only contains the file path.

The two are mutually exclusive. Your script can exist in one place or the other.

When using FILE, once you've added the script to the file system, you may edit the script directly in the file system. A typical approach is that you update the script on your local machine and have a CI/CD tool to deploy and refresh the file. I simply use winscp for my dev/test environment.

In recent versions of Scriptrunner, the Script Editor tool was added. You can find it from the add-ons administration page. There, you can find and edit your file directly from the Jira application. 

Changes to files are effective immediately, there is no need to re-publish the workflow.

Sigursteinn BJarni Húbertsson August 5, 2020

@Peter-Dave Sheehan thank you for the answer :)

I realize what the two tabs are doing, what I was trying to point out is that there is no way of seeing what file is being referenced when the workflow is edited.

In the screenshot, I am trying to edit the post function to see what the filename is, but I cannot choose between FILE or SCRIPT. When I click on ether one the only that remains on the screen is the Inline Script window.

It seems I have to document it very well where each script is for each workflow, not that there is anything wrong with that.

I just needed a way for the Jira admins to be able to quickly tell what script needs to edited.

Thank you :).

Peter-Dave Sheehan
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.
August 5, 2020

Sorry, I misunderstood the question.

I've seen this occasionally after upgrading scriptrunner.

When I go to an older workflow, it doesn't realize that the configuration points to a file and it displays the script tab.

Also, when you have a NOTE in yoru configuration, the PATH of the file is hidden. I wish it still appeared. But if you leave the NOTE empty, then it will show you right in the post function tab where the file is:

Empty:
2020-08-05 10_13_31-Transition_ Create Post-Release Filter - JIRA QSM Dev - https___projects-qsmdev..png

With note:
2020-08-05 10_12_58-Transition_ Create Post-Release Filter - JIRA QSM Dev - https___projects-qsmdev..png

So, my experience is that when I go back to edit that post function, I see this:

2020-08-05 10_15_31-Update Workflow Function Parameters - https___projects-qsmdev.qad.com_secure_adm.png
If you see a blank in-line script editor and you know there is a file, but it won't let you change the tab, enter some text in the script editor then clear it out. It should let you switch back to FILE tab and still show you the file path you selected previously.

Sigursteinn BJarni Húbertsson August 5, 2020

@Peter-Dave Sheehan That does it :), I've tested it on my and and I get the same results.

I will report to my fellow co-workers and let them know to leave it empty in Jira. All the information needed will be in the groovy file.

Thanks a lot for this!


TAGS
AUG Leaders

Atlassian Community Events