Forums

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

ScriptRunner Post Function discrepancies in automatically available Variables/Parameters

Bishal Basak Papan September 24, 2021

Hi,

 

I am using ScriptRunner on my Jira cloud instance. I am trying to add a custom script as a post function for a transition in my Workflow in Jira. When I try to create the script at first, it shows me 4 automatically available parameters, like this:

 

Screenshot (202).png

 

But, the next time when I try to update the script, it is showing only these two automatically available parameters:

 

Screenshot (203).png

 

What might be the reasons behind this? 

 

Note: I have added this workflow to a workflow scheme and also associated this workflow to a company-managed software type project. After activating this workflow, I am trying to add this script as a post function.

1 answer

0 votes
Nic Brough -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 24, 2021

Once a post function is in place, it knows what the logger and issue are, so it doesn't remind you again.

Bishal Basak Papan September 26, 2021

But, as you can see, the variable definition for issueKey is showing an error stating that static type checking, [issue] was not defined. 

Nic Brough -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 26, 2021

It looks like the second screenshot is not of a post-function

Bishal Basak Papan September 27, 2021

Sorry, I think I failed to show my real scenario. The second screenshot is indeed of a post function. I am just trying to modify the post function.

At first I have written the script in the post function by creating a new script in ScriptRunner. The next time I am trying to modify the same script, that's when I find the error in the script (as in the second screenshot) and the two aforementioned variables (issue and transitionInput) absent from the list. 

Bishal Basak Papan September 28, 2021

Hi @Nic Brough -Adaptavist- , it would be great help to me if I knew the reasons behind the situation I am facing. Would you please give some suggestions how to resolve this?

Nic Brough -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 28, 2021

What warning are you getting if you hover the cursor over the waning triangle?  I ask because the issue object should be automatically available to post-function scripts.

Bishal Basak Papan September 28, 2021

Thank you for your response. I am getting error: [Static type checking] - The variable [issue] is undeclared.

 

Screenshot (209).png

Bishal Basak Papan September 28, 2021

Hi @Nic Brough -Adaptavist- , though this part is still showing error in the script, the post function is executing correctly. So I think this is not a big issue. The issueId is pulled from the associated Jira issue though the error is visible in the script. Thank you for your help.

Suggest an answer

Log in or Sign up to answer